Android Open Source - MiniMarketzAndroidApp Main Activity






From Project

Back to project page MiniMarketzAndroidApp.

License

The source code is released under:

GNU General Public License

If you think the Android project MiniMarketzAndroidApp listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.yogi.MiniMarketz;
/* ww w. j  av  a 2 s  .  c o  m*/
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.*;


public class MainActivity extends ListActivity {

    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        String[] values = new String[] { "Pegawai", "Barang", "Transaksi Pembelian", "Transaksi Penjualan", "Quit"};
        // use your own layout
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
                R.layout.main, R.id.label, values);
        setListAdapter(adapter);
    }

   @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
        String item = (String) getListAdapter().getItem(position);
        Toast.makeText(this, item + " selected", Toast.LENGTH_LONG).show();

       if(item == "Pegawai"){
            Intent pegawai = new Intent(MainActivity.this, DataPegawaiActivity.class);
            startActivity(pegawai);
       }

       if(item == "Barang"){
           Intent barang = new Intent(MainActivity.this, DataBarangActivity.class);
           startActivity(barang);
       }

       if(item == "Transaksi Pembelian"){
           Intent transaksipembelian = new Intent(MainActivity.this, TransaksiPembelianActivity.class);
           startActivity(transaksipembelian);
       }

       if(item == "Quit"){
           this.finish();
       }
    }
}




Java Source Code List

com.yogi.MiniMarketz.DataBarangActivity.java
com.yogi.MiniMarketz.DataPegawaiActivity.java
com.yogi.MiniMarketz.JSONParser.java
com.yogi.MiniMarketz.MainActivity.java
com.yogi.MiniMarketz.TransaksiPembelianActivity.java
com.yogi.MiniMarketz.ViewBarangActivity.java
com.yogi.MiniMarketz.ViewPegawaiActivity.java
com.yogi.MiniMarketz.ViewTransaksasiActivity.java