Thursday, July 11, 2019

UAS Membuat Program Android Dengan Eclipse | Hafiz Faturrachman 161011401334

Assalamulaikum Wr,Wb
Selamat Malam ...

Saya : Hafiz Faturrachman
NIM 161011401334

Disini saya membuat aplikasi sederhana menggunakan eclipse yaitu aplikasi penyewaat kendaraan berupa mobil dan motor .Aplikasi ini bertujuan untuk memudahkan pelanggan dalam menyewa kendaraan. 

Pertama kita buat activity login . login disini saya membuat button register untuk pelanggan yang baru pertama kali menggunakan aplikasi ini . 


Lalu saya buat activity register nya 

lalu activity pilihan menu mobil atau motor


Lalu masuk ke menu sewa Mobil dan motor  disni user di minta untuk memasukan pilihan dan lama sewa . lalu klik tombol hitung untuk menghitung jumalah yang harus di bayar 
lalu pesan dan akan muncul alert pesanan berhasil .



Menu tentang saya .


Sekian dari saya lebih kkurang nya saya mohon maaf .
Terima Kasih telah berkunjung .
Hasil run nya di bawah ini 













Source code nya di bawah ini :



package com.example.hafizfaturrachman161011401334; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; public class MainActivity extends Activity implements OnClickListener{ private String[][] dataUser = {{"ADMIN","ADMIN","Administrator"}, {"user1","password1","Nama User 1"}, {"user2","password2","Nama User 2"}}; private EditText userNameET, passwordET; private final int SUCCESS=1; Button button1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); userNameET = (EditText) findViewById(R.id.UserNameEText); passwordET = (EditText) findViewById(R.id.PasswordEText); findViewById(R.id.BTLogin).setOnClickListener(this); findViewById(R.id.BTExit).setOnClickListener(this); button1 = (Button)findViewById(R.id.button1); button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Intent i = new Intent(getApplicationContext(),Register.class); startActivity(i); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()){ case R.id.BTLogin: int i=0; boolean success=false; while ((i arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub int itemke=arg2; String itemText=(String) LV.getItemAtPosition(arg2); Toast.makeText(getBaseContext(), ""+itemText, Toast.LENGTH_LONG).show(); if(itemText.equals("Motor")){ Intent SeninIntent=new Intent(arg0.getContext(),Motor.class); startActivityForResult(SeninIntent,0); }else if (itemText.equals("Mobil")){ Intent SeninIntent=new Intent(arg0.getContext(),Mobil.class); startActivityForResult(SeninIntent, 0); } }}) ; } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu, menu); return true; } } package com.example.hafizfaturrachman161011401334; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.content.Intent; import android.app.TabActivity; import android.widget.TabHost; public class Mobil extends TabActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_mobil); Intent intent; TabHost tabHost = getTabHost(); TabHost.TabSpec spec; intent = new Intent().setClass(this, Sewa.class); spec = getTabHost().newTabSpec("Sewa").setIndicator("Sewa").setContent(intent); tabHost.addTab(spec); intent = new Intent().setClass(this, TentangSaya.class); spec = getTabHost().newTabSpec("Tentang Saya").setIndicator("Tentang Saya").setContent(intent); tabHost.addTab(spec); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.mobil, menu); return true; } } package com.example.hafizfaturrachman161011401334; import android.os.Bundle; import android.app.Activity; import android.app.TabActivity; import android.content.Intent; import android.view.Menu; import android.widget.TabHost; public class Motor extends TabActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_motor); Intent intent; TabHost tabHost = getTabHost(); TabHost.TabSpec spec; intent = new Intent().setClass(this, Sewamotor.class); spec = getTabHost().newTabSpec("Sewa").setIndicator("Sewa").setContent(intent); tabHost.addTab(spec); intent = new Intent().setClass(this, TentangSaya.class); spec = getTabHost().newTabSpec("Tentang Saya").setIndicator("Tentang Saya").setContent(intent); tabHost.addTab(spec); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.motor, menu); return true; } } package com.example.hafizfaturrachman161011401334; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.view.View; import android.widget.Button; public class Register extends Activity { Button button1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register); button1 = (Button)findViewById(R.id.button1); button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Intent i = new Intent(getApplicationContext(),MenuActivity.class); startActivity(i); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.register, menu); return true; } } package com.example.hafizfaturrachman161011401334; import android.os.Bundle; import android.app.Activity; import android.app.AlertDialog; import android.view.*; import android.widget.Button; import android.widget.EditText; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.Toast; import android.widget.RadioGroup.OnCheckedChangeListener; import android.view.View; import android.content.*; public class Sewa extends Activity implements android.widget.RadioGroup.OnCheckedChangeListener { RadioButton rdb1; RadioButton rdb2; RadioButton rdb3; RadioButton rdb4; EditText edit1,edit2,edit3,edit4,edit5; Button hitung,pesan; RadioGroup Rg1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sewa); rdb1 = (RadioButton)findViewById(R.id.rd1); rdb2 = (RadioButton)findViewById(R.id.rd2); rdb3 = (RadioButton)findViewById(R.id.rd3); rdb4 = (RadioButton)findViewById(R.id.rd4); Rg1=(RadioGroup)findViewById(R.id.radioGroup1); Rg1.setOnCheckedChangeListener((OnCheckedChangeListener) this); edit1=(EditText)findViewById(R.id.editText1); edit2=(EditText)findViewById(R.id.editText2); edit3=(EditText)findViewById(R.id.TxtHarga); edit4=(EditText)findViewById(R.id.TxtLSewa); edit5=(EditText)findViewById(R.id.TxtTotal); hitung= (Button) findViewById(R.id.BtnHitung); hitung.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub int h=Integer.parseInt(edit3.getText().toString()); int s=Integer.parseInt(edit4.getText().toString()); int total =h*s; edit5.setText(""+total); } }); pesan= (Button) findViewById(R.id.BtnPesan); pesan.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub AlertDialog.Builder builder = new AlertDialog.Builder(Sewa.this); builder.setTitle("Pemesanan Berhasil !!").setMessage (" Pesanan Anda Berhasil Atas Nama "+edit1.getText()+ " No Tlp "+edit2.getText()+ " Seharga "+edit3.getText()+ " Lama Sewa "+edit4.getText()+ " Hari" + " Total yang anda bayarkan adalah Rp. "+edit5.getText()).setNeutralButton("Ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int witch) { // TODO Auto-generated method stub dialog.cancel(); } }).show(); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.sewa, menu); return true; } @Override public void onCheckedChanged(RadioGroup arg0, int arg1) { // TODO Auto-generated method stub if (rdb1.isChecked()){ Toast.makeText(this,"Anda Memilih Tipe Inova",Toast.LENGTH_LONG).show(); edit3.setText("200000");} else if(rdb2.isChecked()){ Toast.makeText(this,"Anda Memilih Tipe Mobilio",Toast.LENGTH_LONG).show(); edit3.setText("300000");} else if(rdb3.isChecked()){ Toast.makeText(this,"Anda Memilih Tipe Avanza",Toast.LENGTH_LONG).show(); edit3.setText("250000");} else { Toast.makeText(this,"Anda Memilih Tipe Calya",Toast.LENGTH_LONG).show(); edit3.setText("150000");} } } package com.example.hafizfaturrachman161011401334; import android.os.Bundle; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.Toast; import android.widget.RadioGroup.OnCheckedChangeListener; public class Sewamotor extends Activity implements android.widget.RadioGroup.OnCheckedChangeListener { RadioButton rdb1; RadioButton rdb2; RadioButton rdb3; RadioButton rdb4; EditText edit1,edit2,edit3,edit4,edit5; Button hitung,pesan; RadioGroup Rg1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sewamotor); rdb1 = (RadioButton)findViewById(R.id.rd1); rdb2 = (RadioButton)findViewById(R.id.rd2); rdb3 = (RadioButton)findViewById(R.id.rd3); rdb4 = (RadioButton)findViewById(R.id.rd4); Rg1=(RadioGroup)findViewById(R.id.radioGroup1); Rg1.setOnCheckedChangeListener((OnCheckedChangeListener) this); edit1=(EditText)findViewById(R.id.editText1); edit2=(EditText)findViewById(R.id.editText2); edit3=(EditText)findViewById(R.id.TxtHarga); edit4=(EditText)findViewById(R.id.TxtLSewa); edit5=(EditText)findViewById(R.id.TxtTotal); hitung= (Button) findViewById(R.id.BtnHitung); hitung.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub int h=Integer.parseInt(edit3.getText().toString()); int s=Integer.parseInt(edit4.getText().toString()); int total =h*s; edit5.setText(""+total); } }); pesan= (Button) findViewById(R.id.BtnPesan); pesan.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub AlertDialog.Builder builder = new AlertDialog.Builder(Sewamotor.this); builder.setTitle("Pemesanan Berhasil !!").setMessage (" Pesanan Anda Berhasil Atas Nama "+edit1.getText()+ " No Tlp "+edit2.getText()+ " Seharga "+edit3.getText()+ " Lama Sewa "+edit4.getText()+ " Hari" + " Total yang anda bayarkan adalah Rp. "+edit5.getText()).setNeutralButton("Ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int witch) { // TODO Auto-generated method stub dialog.cancel(); } }).show(); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.sewamotor, menu); return true; } @Override public void onCheckedChanged(RadioGroup arg0, int arg1) { // TODO Auto-generated method stub if (rdb1.isChecked()){ Toast.makeText(this,"Anda Memilih Tipe Pcx",Toast.LENGTH_LONG).show(); edit3.setText("100000");} else if(rdb2.isChecked()){ Toast.makeText(this,"Anda Memilih Tipe Nmax",Toast.LENGTH_LONG).show(); edit3.setText("80000");} else if(rdb3.isChecked()){ Toast.makeText(this,"Anda Memilih Tipe Beat",Toast.LENGTH_LONG).show(); edit3.setText("50000");} else { Toast.makeText(this,"Anda Memilih Tipe Mio",Toast.LENGTH_LONG).show(); edit3.setText("50000");} } } package com.example.hafizfaturrachman161011401334; import android.os.Bundle; import android.app.Activity; import android.view.Menu; public class TentangSaya extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tentang_saya); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.tentang_saya, menu); return true; } }


source code xml



///////////"<relativelayout android:background="#000080" android:layout_height="match_parent" android:layout_width="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".MenuActivity" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">

    <listview android:background="#C0C0C0" android:id="@+id/listView1" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_height="wrap_content" android:layout_margintop="14dp" android:layout_width="match_parent">

    </listview>

</relativelayout>

<relativelayout android:background="#000080" android:layout_height="match_parent" android:layout_width="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".MainActivity" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">

    <edittext android:ems="10" android:id="@+id/UserNameEText" android:layout_aligntop="@+id/textView1" android:layout_height="wrap_content" android:layout_marginleft="14dp" android:layout_torightof="@+id/textView1" android:layout_width="wrap_content">

        <requestfocus>
    </requestfocus></edittext>

    <edittext android:ems="10" android:id="@+id/PasswordEText" android:inputtype="textPassword" android:layout_alignbaseline="@+id/textView3" android:layout_alignbottom="@+id/textView3" android:layout_alignleft="@+id/UserNameEText" android:layout_height="wrap_content" android:layout_width="wrap_content">

    <button android:id="@+id/BTLogin" android:layout_alignleft="@+id/textView3" android:layout_alignright="@+id/PasswordEText" android:layout_below="@+id/PasswordEText" android:layout_height="wrap_content" android:layout_margintop="18dp" android:layout_width="wrap_content" android:text="Log In" android:textcolor="#FFFFFF">

    <textview android:id="@+id/textView3" android:layout_alignleft="@+id/textView1" android:layout_below="@+id/UserNameEText" android:layout_height="wrap_content" android:layout_margintop="23dp" android:layout_width="wrap_content" android:text="Password" android:textappearance="?android:attr/textAppearanceLarge" android:textcolor="#FFFFFF">

    <textview android:id="@+id/textView2" android:layout_above="@+id/textView1" android:layout_alignleft="@+id/textView1" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Login">

    <textview android:id="@+id/textView1" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_height="wrap_content" android:layout_marginleft="20dp" android:layout_margintop="160dp" android:layout_width="wrap_content" android:text="User Name" android:textappearance="?android:attr/textAppearanceLarge" android:textcolor="#FFFFFF">

    </textview></textview></textview></button><button android:id="@+id/BTExit" android:layout_alignleft="@+id/button1" android:layout_alignparentbottom="true" android:layout_alignright="@+id/BTLogin" android:layout_height="wrap_content" android:layout_marginbottom="26dp" android:layout_width="match_parent" android:text="Exit" android:textcolor="#FFFFFF">

    </button><button android:id="@+id/button1" android:layout_above="@+id/BTExit" android:layout_alignleft="@+id/BTLogin" android:layout_height="wrap_content" android:layout_width="match_parent" android:text="Register" android:textcolor="#FFFFFF">

</button></edittext></relativelayout>

<relativelayout android:layout_height="match_parent" android:layout_width="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".Mobil" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">

    <tabhost android:id="@android:id/tabhost" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_height="match_parent" android:layout_width="match_parent">

        <linearlayout android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="vertical">

            <tabwidget android:background="#000080" android:id="@android:id/tabs" android:layout_height="wrap_content" android:layout_width="match_parent">

            </tabwidget>

            <framelayout android:id="@android:id/tabcontent" android:layout_height="match_parent" android:layout_width="match_parent">

                <linearlayout android:id="@+id/tab1" android:layout_height="match_parent" android:layout_width="match_parent">
                </linearlayout>

                <linearlayout android:id="@+id/tab2" android:layout_height="match_parent" android:layout_width="match_parent">
                </linearlayout>
            </framelayout>
        </linearlayout>
    </tabhost>

</relativelayout>

<relativelayout android:background="#C0C0C0" android:layout_height="match_parent" android:layout_width="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".Register" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">

    <textview android:id="@+id/textView1" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_height="wrap_content" android:layout_marginleft="40dp" android:layout_margintop="42dp" android:layout_width="wrap_content" android:text="Register" android:textappearance="?android:attr/textAppearanceLarge">

    <textview android:id="@+id/textView3" android:layout_alignright="@+id/textView2" android:layout_below="@+id/textView2" android:layout_height="wrap_content" android:layout_margintop="25dp" android:layout_width="wrap_content" android:text="No Hp" android:textappearance="?android:attr/textAppearanceMedium">

    <textview android:id="@+id/textView4" android:layout_alignright="@+id/textView3" android:layout_centervertical="true" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Email" android:textappearance="?android:attr/textAppearanceMedium">

    <textview android:id="@+id/textView5" android:layout_alignleft="@+id/textView4" android:layout_below="@+id/textView4" android:layout_height="wrap_content" android:layout_margintop="28dp" android:layout_width="wrap_content" android:text="Password" android:textappearance="?android:attr/textAppearanceMedium">

    <button android:id="@+id/button1" android:layout_below="@+id/textView5" android:layout_height="wrap_content" android:layout_margintop="45dp" android:layout_torightof="@+id/textView5" android:layout_width="wrap_content" android:text="Daftar">

    <textview android:id="@+id/textView2" android:layout_alignparentleft="true" android:layout_below="@+id/textView1" android:layout_height="wrap_content" android:layout_marginleft="26dp" android:layout_margintop="37dp" android:layout_width="wrap_content" android:text="Nama" android:textappearance="?android:attr/textAppearanceMedium">

    <edittext android:ems="10" android:id="@+id/editText1" android:layout_alignleft="@+id/button1" android:layout_aligntop="@+id/textView2" android:layout_height="wrap_content" android:layout_width="wrap_content">

        <requestfocus>
    </requestfocus></edittext>

    <edittext android:ems="10" android:id="@+id/editText2" android:inputtype="number" android:layout_aligntop="@+id/textView3" android:layout_height="wrap_content" android:layout_torightof="@+id/textView1" android:layout_width="wrap_content">

    <edittext android:ems="10" android:id="@+id/editText3" android:inputtype="textEmailAddress" android:layout_alignleft="@+id/editText2" android:layout_aligntop="@+id/textView4" android:layout_height="wrap_content" android:layout_width="wrap_content">

    <edittext android:ems="10" android:id="@+id/editText4" android:inputtype="textPassword" android:layout_alignbottom="@+id/textView5" android:layout_alignleft="@+id/editText3" android:layout_height="wrap_content" android:layout_width="wrap_content">

</edittext></edittext></edittext></textview></button></textview></textview></textview></textview></relativelayout>

<relativelayout android:background="#C0C0C0" android:layout_height="match_parent" android:layout_width="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".Sewa" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">

    <radiogroup android:id="@+id/radioGroup1" android:layout_alignparentleft="true" android:layout_below="@+id/editText2" android:layout_height="wrap_content" android:layout_marginleft="35dp" android:layout_width="wrap_content">

        <textview android:id="@+id/textView3" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Tipe Mobil" android:textappearance="?android:attr/textAppearanceMedium">

        <radiobutton android:checked="true" android:id="@+id/rd1" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Inova">

        <radiobutton android:id="@+id/rd2" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Mobilio">

        <radiobutton android:id="@+id/rd3" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Avanza">

        <radiobutton android:id="@+id/rd4" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Calya">
    </radiobutton></radiobutton></radiobutton></radiobutton></textview></radiogroup>

    <edittext android:ems="10" android:id="@+id/editText1" android:layout_alignparentright="true" android:layout_aligntop="@+id/textView1" android:layout_height="wrap_content" android:layout_width="wrap_content">

    <edittext android:ems="10" android:id="@+id/editText2" android:inputtype="number" android:layout_alignparentright="true" android:layout_aligntop="@+id/textView2" android:layout_height="wrap_content" android:layout_width="wrap_content">

        <requestfocus>
    </requestfocus></edittext>

    <edittext android:editable="false" android:ems="10" android:id="@+id/TxtHarga" android:layout_alignleft="@+id/TxtLSewa" android:layout_below="@+id/radioGroup1" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="0">

    <textview android:id="@+id/textView5" android:layout_alignleft="@+id/textView4" android:layout_below="@+id/TxtHarga" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Lama Sewa" android:textappearance="?android:attr/textAppearanceMedium">

    <edittext android:ems="10" android:id="@+id/TxtLSewa" android:inputtype="number" android:layout_alignbottom="@+id/textView5" android:layout_height="wrap_content" android:layout_marginleft="21dp" android:layout_torightof="@+id/textView5" android:layout_width="wrap_content" android:text="0">

    <textview android:id="@+id/textView4" android:layout_above="@+id/TxtLSewa" android:layout_alignright="@+id/textView2" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Harga" android:textappearance="?android:attr/textAppearanceMedium">

    <textview android:id="@+id/textView6" android:layout_below="@+id/textView5" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Total" android:textappearance="?android:attr/textAppearanceMedium">

    <edittext android:editable="false" android:ems="10" android:id="@+id/TxtTotal" android:layout_alignbaseline="@+id/textView6" android:layout_alignbottom="@+id/textView6" android:layout_alignleft="@+id/TxtLSewa" android:layout_height="wrap_content" android:layout_width="wrap_content">

    <textview android:id="@+id/textView1" android:layout_alignleft="@+id/textView6" android:layout_alignparenttop="true" android:layout_height="wrap_content" android:layout_margintop="20dp" android:layout_width="wrap_content" android:text="Nama" android:textappearance="?android:attr/textAppearanceMedium">

    <textview android:id="@+id/textView2" android:layout_alignleft="@+id/textView1" android:layout_below="@+id/editText1" android:layout_height="wrap_content" android:layout_margintop="27dp" android:layout_width="wrap_content" android:text="No Hp" android:textappearance="?android:attr/textAppearanceMedium">

    <button android:id="@+id/BtnHitung" android:layout_alignparentbottom="true" android:layout_alignright="@+id/radioGroup1" android:layout_height="wrap_content" android:layout_marginbottom="14dp" android:layout_width="wrap_content" android:text="Hitung" style="android: attr/buttonStyleSmall;">

    </button><button android:id="@+id/BtnPesan" android:layout_aligntop="@+id/BtnHitung" android:layout_height="wrap_content" android:layout_marginleft="22dp" android:layout_torightof="@+id/BtnHitung" android:layout_width="wrap_content" android:text="Pesan">

</button></textview></textview></edittext></textview></textview></edittext></textview></edittext></edittext></relativelayout>

<relativelayout android:background="#C0C0C0" android:layout_height="match_parent" android:layout_width="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".Sewamotor" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">

       <radiogroup android:id="@+id/radioGroup1" android:layout_alignparentleft="true" android:layout_below="@+id/editText2" android:layout_height="wrap_content" android:layout_marginleft="35dp" android:layout_width="wrap_content">

        <textview android:id="@+id/textView3" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Tipe Motor" android:textappearance="?android:attr/textAppearanceMedium">

        <radiobutton android:checked="true" android:id="@+id/rd1" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Pcx">

        <radiobutton android:id="@+id/rd2" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Nmax">

        <radiobutton android:id="@+id/rd3" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Beat">

        <radiobutton android:id="@+id/rd4" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Mio">
    </radiobutton></radiobutton></radiobutton></radiobutton></textview></radiogroup>

    <edittext android:ems="10" android:id="@+id/editText1" android:layout_alignparentright="true" android:layout_aligntop="@+id/textView1" android:layout_height="wrap_content" android:layout_width="wrap_content">

    <edittext android:ems="10" android:id="@+id/editText2" android:inputtype="number" android:layout_alignparentright="true" android:layout_aligntop="@+id/textView2" android:layout_height="wrap_content" android:layout_width="wrap_content">

        <requestfocus>
    </requestfocus></edittext>

    <edittext android:editable="false" android:ems="10" android:id="@+id/TxtHarga" android:layout_alignleft="@+id/TxtLSewa" android:layout_below="@+id/radioGroup1" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="0">

    <textview android:id="@+id/textView5" android:layout_alignleft="@+id/textView4" android:layout_below="@+id/TxtHarga" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Lama Sewa" android:textappearance="?android:attr/textAppearanceMedium">

    <edittext android:ems="10" android:id="@+id/TxtLSewa" android:inputtype="number" android:layout_alignbottom="@+id/textView5" android:layout_height="wrap_content" android:layout_marginleft="21dp" android:layout_torightof="@+id/textView5" android:layout_width="wrap_content" android:text="0">

    <textview android:id="@+id/textView4" android:layout_above="@+id/TxtLSewa" android:layout_alignright="@+id/textView2" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Harga" android:textappearance="?android:attr/textAppearanceMedium">

    <textview android:id="@+id/textView6" android:layout_below="@+id/textView5" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Total" android:textappearance="?android:attr/textAppearanceMedium">

    <edittext android:editable="false" android:ems="10" android:id="@+id/TxtTotal" android:layout_alignbaseline="@+id/textView6" android:layout_alignbottom="@+id/textView6" android:layout_alignleft="@+id/TxtLSewa" android:layout_height="wrap_content" android:layout_width="wrap_content">

    <textview android:id="@+id/textView1" android:layout_alignleft="@+id/textView6" android:layout_alignparenttop="true" android:layout_height="wrap_content" android:layout_margintop="20dp" android:layout_width="wrap_content" android:text="Nama" android:textappearance="?android:attr/textAppearanceMedium">

    <textview android:id="@+id/textView2" android:layout_alignleft="@+id/textView1" android:layout_below="@+id/editText1" android:layout_height="wrap_content" android:layout_margintop="27dp" android:layout_width="wrap_content" android:text="No Hp" android:textappearance="?android:attr/textAppearanceMedium">

    <button android:id="@+id/BtnHitung" android:layout_alignparentbottom="true" android:layout_alignright="@+id/radioGroup1" android:layout_height="wrap_content" android:layout_marginbottom="14dp" android:layout_width="wrap_content" android:text="Hitung" style="android: attr/buttonStyleSmall;">

    </button><button android:id="@+id/BtnPesan" android:layout_aligntop="@+id/BtnHitung" android:layout_height="wrap_content" android:layout_marginleft="22dp" android:layout_torightof="@+id/BtnHitung" android:layout_width="wrap_content" android:text="Pesan">

</button></textview></textview></edittext></textview></textview></edittext></textview></edittext></edittext></relativelayout>

<relativelayout android:background="#C0C0C0" android:layout_height="match_parent" android:layout_width="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".TentangSaya" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">

    <textview android:id="@+id/textView1" android:layout_alignparenttop="true" android:layout_centerhorizontal="true" android:layout_height="wrap_content" android:layout_margintop="166dp" android:layout_width="wrap_content" android:text="Hafiz Faturrachman" android:textappearance="?android:attr/textAppearanceLarge">

    <textview android:id="@+id/textView3" android:layout_centerhorizontal="true" android:layout_centervertical="true" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="161011401334" android:textappearance="?android:attr/textAppearanceLarge">

    <textview android:id="@+id/textView2" android:layout_alignparentbottom="true" android:layout_centerhorizontal="true" android:layout_height="wrap_content" android:layout_marginbottom="50dp" android:layout_width="wrap_content" android:text="Copyright 2019">

    <textview android:id="@+id/textView4" android:layout_below="@+id/textView3" android:layout_centerhorizontal="true" android:layout_height="wrap_content" android:layout_margintop="27dp" android:layout_width="wrap_content" android:text="06TPLP002" android:textappearance="?android:attr/textAppearanceLarge">

    <imageview android:id="@+id/imageView1" android:layout_alignparenttop="true" android:layout_centerhorizontal="true" android:layout_height="wrap_content" android:layout_margintop="81dp" android:layout_width="wrap_content" android:src="@drawable/ic_launcher1">

</imageview></textview></textview></textview></textview></relativelayout>""

Thursday, April 25, 2019

UTS Membuat Program Android Dengan Eclipse | Hafiz Faturrachman 161011401334

Assalamualaikum , Selamat Sore ,

Pada kesempatan kali ini saya ,
Nama : Hafiz Faturrachman
Nim : 161011401334
Kelas : 06TPLP002

Akan sedikit memberi tutorial membuat aplikasi android menggunakan eclipse . Program yang saya buat kali ini adalah aplikasi penyewaan kendaraan dengan tujuan memudahkan pelanggan dapat dengan mudah menyewa kendaraan .

Pertama-tama buat activity yang akan kita gunakan untuk halaman login .saya disini hanya memasukan fungsi text, text field dan button  :

Selanjutnya saya membuat activity baru untuk  menu list view yang berisi pilihan Mobil atau Motor :


Selanjutnnya masuk ke Activity yang di pilih contohnya Mobil , dalam activity mobil saya memasukan tabhost yang terhubung dengan activity sewa dan activity tentang saya :


Dalam Activity Sewa saya memasukan text field, radio button , dan button .Radio Button ini untuk memilih jenis mobil dan otomatis memasukan harga sewa mobil , dan tombol hitung untuk menghitung total harga sewa di kali dengan lama sewa, dan ada juga tombol pesan untuk melakukan proses pemesanan yang akan memunculkan alert  :


Ini Adalah Activity tentang saya yang berisi biodata pembuat :



Hasil Run nya Sebagai Berikut :
Login


Menu Pilihan :


Di Dalam Menu Pilihan Mobil: 


Memasukan Data Pemesanan dan pilih tipe mobil dan lama sewa: 


Klik Hitung mentotal harga Sewa :


Klik Pesan Untuk Proses penyewaan : 


Tentang Saya : 




Sekian Dari saya , Mohon maaf jika masih banyak kekurangan .
Terima kasih telah berkunjung .


Source Code Program Ada Di Bawah Sini : 

Source Kode Java.

p ackage com.example.hafizfaturrachman161011401334; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.EditText; public class MainActivity extends Activity implements OnClickListener{ private String[][] dataUser = {{"ADMIN","ADMIN","Administrator"}, {"user1","password1","Nama User 1"}, {"user2","password2","Nama User 2"}}; private EditText userNameET, passwordET; private final int SUCCESS=1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); userNameET = (EditText) findViewById(R.id.UserNameEText); passwordET = (EditText) findViewById(R.id.PasswordEText); findViewById(R.id.BTLogin).setOnClickListener(this); findViewById(R.id.BTExit).setOnClickListener(this); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()){ case R.id.BTLogin: int i=0; boolean success=false; while ((i

------------------------------------------------------------------


package com.example.hafizfaturrachman161011401334;

import android.os.Bundle;
import android.app.Activity;
import android.view.*;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import android.content.Intent;

public class MenuActivity extends Activity {
ListView LV;
String [] sewa={"Mobil","Motor"};

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu);
LV=(ListView) findViewById(R.id.listView1);
        ArrayAdapter adapter=new ArrayAdapter(this,android.R.layout.simple_list_item_1,sewa);

        LV.setAdapter(adapter);
        LV.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
        long arg3) {
        // TODO Auto-generated method stub
        int itemke=arg2;
        String itemText=(String) LV.getItemAtPosition(arg2);
        Toast.makeText(getBaseContext(), ""+itemText, Toast.LENGTH_LONG).show();
       
        if(itemText.equals("Motor")){
        Intent SeninIntent=new Intent(arg0.getContext(),Motor.class);
        startActivityForResult(SeninIntent,0);

        }else if (itemText.equals("Mobil")){
            Intent SeninIntent=new Intent(arg0.getContext(),Mobil.class);
            startActivityForResult(SeninIntent, 0);

        }
        }}) ;
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu, menu);
return true;
}

}


------------------------------------------------------------------

package com.example.hafizfaturrachman161011401334;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.content.Intent;
import android.app.TabActivity;
import android.widget.TabHost;
public class Mobil extends TabActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mobil);
Intent intent;
     
        TabHost tabHost = getTabHost();
        TabHost.TabSpec spec;
        intent = new Intent().setClass(this, Sewa.class);
        spec = getTabHost().newTabSpec("Sewa").setIndicator("Sewa").setContent(intent);
        tabHost.addTab(spec);
        intent = new Intent().setClass(this, TentangSaya.class);
        spec = getTabHost().newTabSpec("Tentang Saya").setIndicator("Tentang Saya").setContent(intent);
        tabHost.addTab(spec);
     
     
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.mobil, menu);
return true;
}

}

------------------------------------------------------------------


package com.example.hafizfaturrachman161011401334;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class Motor extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_motor);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.motor, menu);
return true;
}

}


------------------------------------------------------------------


package com.example.hafizfaturrachman161011401334;



import android.os.Bundle;
import android.app.Activity;
import android.app.AlertDialog;
import android.view.*;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Toast;
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.view.View;
import android.content.*;


public class Sewa extends Activity implements android.widget.RadioGroup.OnCheckedChangeListener {

RadioButton rdb1;
RadioButton rdb2;
RadioButton rdb3;
RadioButton rdb4;
EditText edit1,edit2,edit3,edit4,edit5;
Button hitung,pesan;
RadioGroup Rg1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sewa);
rdb1 = (RadioButton)findViewById(R.id.rd1);
rdb2 = (RadioButton)findViewById(R.id.rd2);
rdb3 = (RadioButton)findViewById(R.id.rd3);
rdb4 = (RadioButton)findViewById(R.id.rd4);
Rg1=(RadioGroup)findViewById(R.id.radioGroup1);
Rg1.setOnCheckedChangeListener((OnCheckedChangeListener) this);
edit1=(EditText)findViewById(R.id.editText1);
edit2=(EditText)findViewById(R.id.editText2);
edit3=(EditText)findViewById(R.id.TxtHarga);
edit4=(EditText)findViewById(R.id.TxtLSewa);
edit5=(EditText)findViewById(R.id.TxtTotal);
hitung= (Button) findViewById(R.id.BtnHitung);
        hitung.setOnClickListener(new View.OnClickListener()
        
        {
        @Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
int h=Integer.parseInt(edit3.getText().toString());
int s=Integer.parseInt(edit4.getText().toString());
int total =h*s;
edit5.setText(""+total);
}
        });
        
        pesan= (Button) findViewById(R.id.BtnPesan);
        pesan.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
AlertDialog.Builder builder = new AlertDialog.Builder(Sewa.this);
builder.setTitle("Pemesanan Berhasil !!").setMessage
(" Pesanan Anda Berhasil Atas Nama "+edit1.getText()+
" No Tlp "+edit2.getText()+ 
" Seharga "+edit3.getText()+
" Lama Sewa "+edit4.getText()+ " Hari" +
" Total yang anda bayarkan adalah Rp. "+
edit5.getText()).setNeutralButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int witch) {
// TODO Auto-generated method stub
dialog.cancel();
}
}).show();
}
});
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.sewa, menu);
return true;
}

@Override
public void onCheckedChanged(RadioGroup arg0, int arg1) {
// TODO Auto-generated method stub
if (rdb1.isChecked()){
Toast.makeText(this,"Anda Memilih Tipe Inova",Toast.LENGTH_LONG).show();
edit3.setText("200000");}
else if(rdb2.isChecked()){
Toast.makeText(this,"Anda Memilih Tipe Mobilio",Toast.LENGTH_LONG).show();
edit3.setText("300000");}
else if(rdb3.isChecked()){
Toast.makeText(this,"Anda Memilih Tipe Avanza",Toast.LENGTH_LONG).show();
edit3.setText("250000");}
else  {
Toast.makeText(this,"Anda Memilih Tipe Calya",Toast.LENGTH_LONG).show();
edit3.setText("150000");}

}
}


------------------------------------------------------------------


package com.example.hafizfaturrachman161011401334;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class TentangSaya extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tentang_saya);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.tentang_saya, menu);
return true;
}

}


------------------------------------------------------------------
Source Kode XML

/<relativelayout android:ems="10" android:id="@+id/UserNameEText" android:layout_aligntop="@+id/textView1" android:layout_height="wrap_content" android:layout_marginleft="14dp" android:layout_torightof="@+id/textView1" android:layout_width="wrap_content" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" edittext="" gt="" tools:context=".MainActivity" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">

        <requestfocus>
    </requestfocus></relativelayout></div>
<edittext android:ems="10" android:id="@+id/PasswordEText" android:inputtype="textPassword" android:layout_alignbaseline="@+id/textView3" android:layout_alignbottom="@+id/textView3" android:layout_alignleft="@+id/UserNameEText" android:layout_height="wrap_content" android:layout_width="wrap_content">

    <button android:id="@+id/BTLogin" android:layout_alignleft="@+id/textView3" android:layout_alignright="@+id/PasswordEText" android:layout_below="@+id/PasswordEText" android:layout_height="wrap_content" android:layout_margintop="18dp" android:layout_width="wrap_content" android:text="Log In">

    <textview android:id="@+id/textView3" android:layout_alignleft="@+id/textView1" android:layout_below="@+id/UserNameEText" android:layout_height="wrap_content" android:layout_margintop="23dp" android:layout_width="wrap_content" android:text="Password" android:textappearance="?android:attr/textAppearanceLarge">

    <textview android:id="@+id/textView2" android:layout_above="@+id/textView1" android:layout_alignleft="@+id/textView1" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Login">

    <textview android:id="@+id/textView1" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_height="wrap_content" android:layout_marginleft="20dp" android:layout_margintop="160dp" android:layout_width="wrap_content" android:text="User Name" android:textappearance="?android:attr/textAppearanceLarge">

    </textview></textview></textview></button><button android:id="@+id/BTExit" android:layout_alignparentright="true" android:layout_below="@+id/BTLogin" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Exit">

</button></edittext>
------------------------------------------------------------------

<relativelayout android:layout_height="match_parent" android:layout_width="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".MenuActivity" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">

    <listview android:id="@+id/listView1" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_height="wrap_content" android:layout_margintop="14dp" android:layout_width="match_parent">
    </listview>

</relativelayout>

------------------------------------------------------------------

"<relativelayout android:layout_height="match_parent" android:layout_width="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".Mobil" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">

    <tabhost android:id="@android:id/tabhost" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_height="match_parent" android:layout_width="match_parent">

        <linearlayout android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="vertical">

            <tabwidget android:id="@android:id/tabs" android:layout_height="wrap_content" android:layout_width="match_parent">
            </tabwidget>

            <framelayout android:id="@android:id/tabcontent" android:layout_height="match_parent" android:layout_width="match_parent">

                <linearlayout android:id="@+id/tab1" android:layout_height="match_parent" android:layout_width="match_parent">
                </linearlayout>

                <linearlayout android:id="@+id/tab2" android:layout_height="match_parent" android:layout_width="match_parent">
                </linearlayout>
            </framelayout>
        </linearlayout>
    </tabhost>

</relativelayout>"


------------------------------------------------------------------

"<relativelayout android:layout_height="match_parent" android:layout_width="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".Sewa" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">

    <radiogroup android:id="@+id/radioGroup1" android:layout_alignparentleft="true" android:layout_below="@+id/editText2" android:layout_height="wrap_content" android:layout_marginleft="35dp" android:layout_width="wrap_content">

        <textview android:id="@+id/textView3" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Tipe Mobil" android:textappearance="?android:attr/textAppearanceMedium">

        <radiobutton android:checked="true" android:id="@+id/rd1" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Inova">

        <radiobutton android:id="@+id/rd2" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Mobilio">

        <radiobutton android:id="@+id/rd3" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Avanza">

        <radiobutton android:id="@+id/rd4" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Calya">
    </radiobutton></radiobutton></radiobutton></radiobutton></textview></radiogroup>

    <edittext android:ems="10" android:id="@+id/editText1" android:layout_alignparentright="true" android:layout_aligntop="@+id/textView1" android:layout_height="wrap_content" android:layout_width="wrap_content">

    <edittext android:ems="10" android:id="@+id/editText2" android:inputtype="number" android:layout_alignparentright="true" android:layout_aligntop="@+id/textView2" android:layout_height="wrap_content" android:layout_width="wrap_content">

        <requestfocus>
    </requestfocus></edittext>

    <edittext android:editable="false" android:ems="10" android:id="@+id/TxtHarga" android:layout_alignleft="@+id/TxtLSewa" android:layout_below="@+id/radioGroup1" android:layout_height="wrap_content" android:layout_width="wrap_content">

    <textview android:id="@+id/textView5" android:layout_alignleft="@+id/textView4" android:layout_below="@+id/TxtHarga" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Lama Sewa" android:textappearance="?android:attr/textAppearanceMedium">

    <edittext android:ems="10" android:id="@+id/TxtLSewa" android:inputtype="number" android:layout_alignbottom="@+id/textView5" android:layout_height="wrap_content" android:layout_marginleft="21dp" android:layout_torightof="@+id/textView5" android:layout_width="wrap_content">

    <textview android:id="@+id/textView4" android:layout_above="@+id/TxtLSewa" android:layout_alignright="@+id/textView2" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Harga" android:textappearance="?android:attr/textAppearanceMedium">

    <textview android:id="@+id/textView6" android:layout_below="@+id/textView5" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Total" android:textappearance="?android:attr/textAppearanceMedium">

    <edittext android:editable="false" android:ems="10" android:id="@+id/TxtTotal" android:layout_alignbaseline="@+id/textView6" android:layout_alignbottom="@+id/textView6" android:layout_alignleft="@+id/TxtLSewa" android:layout_height="wrap_content" android:layout_width="wrap_content">

    <textview android:id="@+id/textView1" android:layout_alignleft="@+id/textView6" android:layout_alignparenttop="true" android:layout_height="wrap_content" android:layout_margintop="20dp" android:layout_width="wrap_content" android:text="Nama" android:textappearance="?android:attr/textAppearanceMedium">

    <textview android:id="@+id/textView2" android:layout_alignleft="@+id/textView1" android:layout_below="@+id/editText1" android:layout_height="wrap_content" android:layout_margintop="27dp" android:layout_width="wrap_content" android:text="No Hp" android:textappearance="?android:attr/textAppearanceMedium">

    <button android:id="@+id/BtnHitung" android:layout_alignparentbottom="true" android:layout_alignright="@+id/radioGroup1" android:layout_height="wrap_content" android:layout_marginbottom="14dp" android:layout_width="wrap_content" android:text="Hitung" style="android: attr/buttonStyleSmall;">

    </button><button android:id="@+id/BtnPesan" android:layout_aligntop="@+id/BtnHitung" android:layout_height="wrap_content" android:layout_marginleft="22dp" android:layout_torightof="@+id/BtnHitung" android:layout_width="wrap_content" android:text="Pesan">

</button></textview></textview></edittext></textview></textview></edittext></textview></edittext></edittext></relativelayout>"


------------------------------------------------------------------


"<relativelayout android:layout_height="match_parent" android:layout_width="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".TentangSaya" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">

    <textview android:id="@+id/textView1" android:layout_alignparenttop="true" android:layout_centerhorizontal="true" android:layout_height="wrap_content" android:layout_margintop="166dp" android:layout_width="wrap_content" android:text="Hafiz Faturrachman" android:textappearance="?android:attr/textAppearanceLarge">

    <textview android:id="@+id/textView3" android:layout_centerhorizontal="true" android:layout_centervertical="true" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="161011401334" android:textappearance="?android:attr/textAppearanceLarge">

    <textview android:id="@+id/textView2" android:layout_alignparentbottom="true" android:layout_centerhorizontal="true" android:layout_height="wrap_content" android:layout_marginbottom="50dp" android:layout_width="wrap_content" android:text="Copyright 2019">

    <textview android:id="@+id/textView4" android:layout_below="@+id/textView3" android:layout_centerhorizontal="true" android:layout_height="wrap_content" android:layout_margintop="27dp" android:layout_width="wrap_content" android:text="06TPLP002" android:textappearance="?android:attr/textAppearanceLarge">

</textview></textview></textview></textview></relativelayout>"