UAS Mobile Prgramming REGI RIO FAZA (NIM 161021450386) (06TPLE003)
STMIK ERESHA
NAMA : REGI RIO FAZA
NIM : 161021450386 (06TPLE003)
Assalamu"alaikum Wr Wb...
Kali ini saya akan memposting hasil UAS yang kemarin di kerjakan, hasil kali ini menggunakan list view, dan saya hanya menggunakan list view statik...
Menggunakan list view statik
NAMA : REGI RIO FAZA
NIM : 161021450386 (06TPLE003)
Assalamu"alaikum Wr Wb...
Kali ini saya akan memposting hasil UAS yang kemarin di kerjakan, hasil kali ini menggunakan list view, dan saya hanya menggunakan list view statik...
Menggunakan list view statik
A. Deskripsi Aplikasi
- Aplikasi berisi transaksi pembelian seragam satpam dengan harga yang di setting sebelumnya di dalam code program java.
- Aplikasi berisi beberapa kolom seperti : --> Nama Pembeli, --> Nama order, --> Jumlah Beli, --> Harga Rp, --> Uang Bayar.
- kemudian terdapat tombol PROSES --> untuk memproses penghitungan, tombol RESET --> untuk me-reset/hapus penghitungan, tombol KELUAR --> untuk keluar dari aplikasi.
- Karena konveksi kami memberi bonus jika terdapat transaksi minimum yang di lakukan, maka aplikasi ini juga menyesuaikan hal tersebut. karena telah di setting di dalam coding.
- Penambahan source code list view statik dalam program.
---> MAIN ACTIVITY.XML
</ScrollView><?xml version="1.0" encoding="utf-8"?><ScrollView xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"android:padding="30dp"android:orientation="vertical"tools:context=".MainActivity"> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Nama Pembeli : " android:textColor="#F51B06" android:textStyle="bold" /> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/namapelanggan" android:text="" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Nama order : " android:textColor="#F71306" android:textStyle="bold" /> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/namabarang" android:text="" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Jumlah Beli: " android:textColor="#F71204" android:textStyle="bold" /> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/jumlahbeli" android:text="" android:inputType="number"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Harga : Rp " android:textColor="#F71204" android:textStyle="bold" /> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/harga" android:text="" android:inputType="number" android:layout_marginBottom="8dp" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Uang Bayar: Rp " android:textColor="#F71707" android:textStyle="bold" /> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/uangbayar" android:text="" android:inputType="number"/> </LinearLayout> <Button android:id="@+id/tombol1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="30dp" android:layout_marginBottom="8dp" android:background="#110101" android:text="PROSES" android:textColor="#ffffff" android:textStyle="bold" /> <LinearLayout android:layout_marginTop="20dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:orientation="horizontal"> <Button android:id="@+id/tombol2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#0C0201" android:text="RESET DATA" android:textColor="#ffffFF" android:textStyle="bold" /> <Button android:id="@+id/tombol3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="20dp" android:background="#0C0104" android:text="KELUAR" android:textColor="#FFFFFF" android:textStyle="bold" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <ListView android:id="@+id/lv" android:layout_width="match_parent" android:layout_height="wrap_content"/> </LinearLayout> </LinearLayout>
---> SOURCE CODE STRING.XML
Untuk menampilkan list view pada program
<resources> <string name="app_name">JualApp</string> <string-array name="nama"> <item>PDL</item> <item>PDH</item> <item>SAFARI</item> <item>KAOS TRAINING</item> <item>SEPATU PDH</item> <item>SEPATU PDL</item> <item>HT</item> <item>TOPI</item> </string-array> </resources>---> SOUURCE CODE mainActivity.javapackage com.example.jualapp; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity { private EditText edtnamapel, edtnamabar, edtjumlahbel, edtharga, edtuangbay; private Button btnproses; private Button btnhapus; private Button btnexit; private TextView txtnamapel; private TextView txtnamabar; private TextView txtjumlahbel; private TextView txtharga; private TextView txtuangbay; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); getSupportActionBar().setTitle(" REGI RIO FAZA (161021450386) (06TPLE003) WORKING WEAR SHOP "); edtnamapel = (EditText) findViewById(R.id.namapelanggan); edtnamabar = (EditText) findViewById(R.id.namabarang); edtjumlahbel = (EditText) findViewById(R.id.jumlahbeli); edtharga = (EditText) findViewById(R.id.harga); edtuangbay = (EditText) findViewById(R.id.uangbayar); btnproses = (Button) findViewById(R.id.tombol1); btnhapus = (Button) findViewById(R.id.tombol2); btnexit = (Button) findViewById(R.id.tombol3); txtnamapel = (TextView) findViewById(R.id.namapelanggan); txtnamabar = (TextView) findViewById(R.id.namabarang); txtjumlahbel = (TextView) findViewById(R.id.jumlahbeli); txtharga = (TextView) findViewById(R.id.harga); txtuangbay = (TextView) findViewById(R.id.uangbayar); //memberikan action pada tombol proses btnproses.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String namapelanggan = edtnamapel.getText().toString().trim(); String namabarang = edtnamabar.getText().toString().trim(); String jumlahbeli = edtjumlahbel.getText().toString().trim(); String harga = edtharga.getText().toString().trim(); String uangbayar = edtuangbay.getText().toString().trim(); double jb = Double.parseDouble(jumlahbeli); double h = Double.parseDouble(harga); double ub = Double.parseDouble(uangbayar); String textUangBayar = Double.toString(ub); double total = (jb * h); String textTotal = Double.toString(total).trim(); //pemberian if dan else untuk aturan pemberian bonus String bonus; if (total >=200000){ bonus = "Bonus : Bordir Nama"; } else if (total >=50000){ bonus = "Bonus : Bordir Logo"; } else if (total >=40000){ bonus = "Bonus : HT"; } else { bonus = "Bonus : Tidak Ada Bonus"; } double uangkembalian = (ub - total); String textUangkembalian = Double.toString(uangkembalian); Intent x = new Intent(MainActivity.this, Proses.class); x.putExtra("tb", textTotal); x.putExtra("uk", textUangkembalian); x.putExtra("bn", bonus); x.putExtra("ub", textUangBayar); startActivity(x); } }); btnhapus.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { txtnamapel.setText(" "); txtnamabar.setText(" "); txtharga.setText(" "); txtuangbay.setText(" "); txtjumlahbel.setText(" "); Toast.makeText(getApplicationContext(),"Data sudah direset", Toast.LENGTH_LONG).show(); } }); btnexit.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { moveTaskToBack(true); } }); ListView listView = findViewById(R.id.lv); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.nama, android.R.layout.simple_list_item_1); listView.setAdapter(adapter); } }---> SCREEN SHOT PROGRAM MELALUI EMULATOR/GADGET ANDROID1. TAMPILAN AWAL PROGRAM2. TAMPILAN INPUT DATA3. TAMPILAN PROSES4. LETAK TAMPILAN LIST VIEW STATIC YANG SAYA BIKIN PADA EMULATOR/GADGET ANDDROID5. KALI INI LAPTOP SAYA TERHUBUNG/TERKONEKSI/DEBUGGING DENGAN HP ASUS, DAN BERIKUT ICON TAMPILANNYABerikut UAS yang saya kumpulkan, kurang lebihnya mohon maafWassalamu"alaikum Wr Wb :) :) :) :) :)
Komentar
Posting Komentar