setelah kita membuat form registrasi kemudian kita membuat listmenu.java
package com.aplikasimotor;
import java.io.IOException;
import java.util.List;
import java.util.Locale;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import android.location.LocationListener;
import android.os.Bundle;
import android.text.Html;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;
public class listmenu extends Activity implements AdapterView.OnItemClickListener{
private ListView listView1;
String xml="CST01#ORD1412004#sukses";
String kode_order,kode_customer;
String pilih="";
TextView txtMarquee;
listheadermenu []listheadericon_data;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.listmenu);
Intent io = this.getIntent();
xml=io.getStringExtra("xml");
String[]ar=xml.split("#");
kode_customer=ar[0];
kode_order=ar[1];
listheadericon_data = new listheadermenu[]{
new listheadermenu(R.drawable.profil, "Data Customer"),
new listheadermenu(R.drawable.motor, "Sparepart Motor"),
new listheadermenu(R.drawable.tas, "Order"),
new listheadermenu(R.drawable.database, "Arsip"),
new listheadermenu(R.drawable.petunjuk1, "Petunjuk"),
new listheadermenu(R.drawable.exit, "Logout") };
listitemmenu adapter = new listitemmenu(this,R.layout.listitemmenu, listheadericon_data);
listView1 = (ListView)findViewById(R.id.listView1);
View header = (View)getLayoutInflater().inflate(R.layout.listheadermenu, null);
listView1.addHeaderView(header);
listView1.setAdapter(adapter);
listView1.setOnItemClickListener((OnItemClickListener) this);
}
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
String pilih="";
position=position-1;
if(position==0){pilih="Data Customer";
Intent put= new Intent(getBaseContext(), biodata.class);
put.putExtra("kode_customer", kode_customer);
startActivity(put);
}
else if(position==1){pilih="Sparepart Motor";
Intent put= new Intent(getBaseContext(), listmotor.class);
put.putExtra("kode_order", kode_order);
startActivity(put);}
else if(position==2){pilih="Order";
Intent put= new Intent(getBaseContext(), listorder.class);
put.putExtra("kode_customer", kode_customer);
startActivity(put);}
else if(position==3){pilih="Arsip";
Intent put= new Intent(getBaseContext(), listarsip.class);
put.putExtra("kode_customer", kode_customer);
startActivity(put);}
else if(position==4){pilih="Tentang";
Intent put= new Intent(getBaseContext(), about.class);
startActivity(put);}
else if(position==5){pilih="Logout";
keluarYN();}
else{
pilih="Silakan Pilih Menu";
}
}
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
keluarYN();
return true;
}
return super.onKeyDown(keyCode, event);
}
public void keluarYN(){
AlertDialog.Builder ad=new AlertDialog.Builder(listmenu.this);
ad.setTitle("Konfirmasi");
ad.setMessage("Apakah Benar Ingin Logout?");
ad.setPositiveButton("OK",new OnClickListener(){
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(listmenu.this,"Terima Kasih Telah Menggunakan Aplikasi", Toast.LENGTH_LONG).show();
finish();
}});
ad.setNegativeButton("No",new OnClickListener(){
public void onClick(DialogInterface arg0, int arg1) {
Toast.makeText(listmenu.this,"Selamat Datang di Aplikasi", Toast.LENGTH_LONG).show();
}});
ad.show();
}
}
buatkan lisitemmenu.java
package com.aplikasimotor;
import android.app.Activity;
import android.content.Context;
import android.view.*;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
public class listitemmenu extends ArrayAdapter<listheadermenu>{
Context context;
int layoutResourceId;
listheadermenu data[] = null;
public listitemmenu(Context context, int layoutResourceId, listheadermenu[] data) {
super(context, layoutResourceId, data);
this.layoutResourceId = layoutResourceId;
this.context = context;
this.data = data;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
listheaderHolder holder = null;
if(row == null)
{
LayoutInflater inflater = ((Activity)context).getLayoutInflater();
row = inflater.inflate(layoutResourceId, parent, false);
holder = new listheaderHolder();
holder.imgIcon = (ImageView)row.findViewById(R.id.imgIcon);
holder.txtTitle = (TextView)row.findViewById(R.id.txtTitle);
row.setTag(holder);
}
else
{
holder = (listheaderHolder)row.getTag();
}
listheadermenu listheader = data[position];
holder.txtTitle.setText(listheader.title);
holder.imgIcon.setImageResource(listheader.icon);
return row;
}
static class listheaderHolder
{
ImageView imgIcon;
TextView txtTitle;
}
}
buatkan listheadermenu .java
package com.aplikasimotor;
public class listheadermenu {
public int icon;
public String title;
public listheadermenu(){
super();
}
public listheadermenu(int icon, String title) {
super();
this.icon = icon;
this.title = title;
}
}
selanjutnya membuat layoutnya listmenu.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/listView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>
listitemmenu.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="1dp"
>
<ImageView android:id="@+id/imgIcon"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:gravity="center_vertical"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="5dp"
android:layout_marginTop="1dp"
android:layout_marginBottom="1dp" />
<TextView
android:id="@+id/txtTitle"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="5dp"
android:layout_marginTop="1dp"
android:gravity="center_vertical"
android:textColor="#ffffff"
android:textSize="22dp"
android:textStyle="bold" />
</LinearLayout>
listheadermenu.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</LinearLayout>
tampilan menu seperti gambar di bawah

jasa pembuatan program skripsi dan tugas akhir