DAFTAR PUSTAKA
1. Stephanus, HS 2011, ‘Mudah Membuat Aplikasi Android’, Yogyakarta, Jawa Tengah, pp. 215-222. 2. A. A. Huda, 24 Jam!! Pintar Pemrograman Android, Andi, Yogyakarta, 2012. 3. N. Safaat, Pemrograman Aplikasi Mobile Smartphone dan Tablet PC
Berbasis
Android, Informatika, Bandung, 2011. 4. I. M. Siregar, Mengembangkan Aplikasi Enterprise Berbasis Android, Gava Media, Yogyakarta, 2011. 5. I. M. Siregar, Membongkar Source Code Berbagai Aplikasi Android. Gava Media, Yogyakarta, 2011. 6. Depkes RI, 2006. Pedoman Umum Pengelolaan Posyandu. Jakarta: Departemen Kesehatan RI dan Kelompok Kerja Operasional (POKJANAL POSYANDU). 7. Departemen kesehatan RI. 2006. Buku Kader Posyandu Dalam Usaha Perbaikan Gizi Keluarga. Jakarta. 8. Depkes RI. 1996. Pedoman Kegiatan Kader di Pos Pelayanan terpadu. Jakarta : Depkes RI 9. Jenis-jenis vitamin, http://manfaatnyasehat.blogspot.com/2013/07/jenis-jenis-vitamindan-fungsinya-bagi.html Mei 2014 10. Macam-macam vitamin, http://www.tabloiddokter.com/macam-macam-vitamin.html Mei 2014 11. https://search.proquest.com/docview/210945283/13F796FD813F4DDCB4/1?accounti d=34643, Diakses 18 April 12. https://search.proquest.com/docview/21744852?accountid=34643, Diakses pada 18 Mei 2014
LAMPIRAN
com.tugasakhir.adapter 1.
KeteranganVitaminAdapter.java package com.tugasakhir.adapter; import java.util.ArrayList; import com.tugasakhir.src.R; import android.app.Activity; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; public class KeteranganVitaminAdapter extends BaseAdapter { // Deklarasi Variabel private ArrayList<String> mData = new ArrayList<String>(); private LayoutInflater mInflater; // class pada saat fungsi onclick berjalan public KeteranganVitaminAdapter(Activity activity) { mInflater = (LayoutInflater) activity .getSystemService(Context.LAYOUT_INFLATER_SERVICE); } // tambah jumlah array data public void addItem(String item) { mData.add(item); notifyDataSetChanged(); } // cari jumlah array data public int getCount() { return mData.size(); } public String getItem(int position) { return mData.get(position); } public long getItemId(int position) { return position; } // set variabel untuk listview
public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; if (convertView == null) { holder = new ViewHolder(); convertView = mInflater.inflate(R.layout.single_kebutuhan_vitamin, null); holder.textView = (TextView) convertView.findViewById(R.id.text); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } String str = mData.get(position); holder.textView.setText(str); return convertView; } // set variabel untuk menampung nilai pada layout public class ViewHolder { public TextView textView; } } 2.
PemberianVitaminAdapter.java package com.tugasakhir.adapter; import java.util.ArrayList; import com.tugasakhir.lib.PemberianVitamin; import com.tugasakhir.src.DaftarPemberianVitamin; import com.tugasakhir.src.R; import android.app.Activity; import android.content.Context; import android.content.res.Resources; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; public class PemberianVitaminAdapter extends BaseAdapter implements OnClickListener { // Deklarasi Variabel private Activity activity; private ArrayList> data; private static LayoutInflater inflater = null; public Resources res; PemberianVitamin tempValues = null;
int i = 0; // Konstruktor Adapter public PemberianVitaminAdapter(Activity a, ArrayList> d, Resources resLocal) { // set variabel untuk adapter activity = a; data = d; res = resLocal; // layout inflater untuk layout xml inflater = (LayoutInflater) activity .getSystemService(Context.LAYOUT_INFLATER_SERVICE); } // cari jumlah array data public int getCount() { if (data.size() <= 0) return 1; return data.size(); } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } // set variabel untuk menampung nilai pada layout public static class ViewHolder { public TextView tPosyandu; public TextView tBalita; public TextView tUmur; public TextView tIbu; } // set variabel untuk listview public View getView(int position, View convertView, ViewGroup parent) { View vi = convertView; ViewHolder holder; if (convertView == null) { // set layout inflater untuk row di listview vi = inflater.inflate(R.layout.single_pemberian_vitamin, null);
holder = new ViewHolder(); holder.tPosyandu = (TextView) vi .findViewById(R.id.txt_list_posyandu); holder.tBalita = (TextView) vi.findViewById(R.id.txt_list_balita); holder.tUmur = (TextView) vi.findViewById(R.id.txt_list_umur); holder.tIbu = (TextView) vi.findViewById(R.id.txt_list_ibu); vi.setTag(holder); } else holder = (ViewHolder) vi.getTag(); if (data.size() <= 0) { holder.tPosyandu.setText("No Data"); } else { // ambil nilai dari array data tempValues = null; tempValues = (PemberianVitamin) data.get(position); // set variabel untuk menampung nilai dari array data holder.tPosyandu.setText("Nama Posyandu : " + tempValues.getPemberianVitaminPosyandu()); holder.tBalita.setText("Nama Balita :" + tempValues.getPemberianVitaminBalita()); holder.tUmur.setText("Umur Balita :" + tempValues.getPemberianVitaminUmur() + " Bulan"); holder.tIbu.setText("Nama Ibu :" + tempValues.getPemberianVitaminIbu()); // set fungsi onclick pada listview vi.setOnClickListener(new OnItemClickListener(position)); } return vi; } @Override public void onClick(View v) { // cek apakah fungsi onclick dapat berjalan Log.v("OnClick: ", "Running"); } // class pada saat fungsi onclick berjalan private class OnItemClickListener implements OnClickListener { private int mPosition; OnItemClickListener(int position) { mPosition = position; } @Override public void onClick(View arg0) {
DaftarPemberianVitamin sct = (DaftarPemberianVitamin) activity; // fungsi onclick didalam listview sct.onItemClick(mPosition); } } } 3.
PosyanduAdapter.java package com.tugasakhir.adapter; import java.util.ArrayList; import com.tugasakhir.lib.Posyandu; import com.tugasakhir.src.DaftarPosyandu; import com.tugasakhir.src.R; import android.app.Activity; import android.content.Context; import android.content.res.Resources; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; public class PosyanduAdapter extends BaseAdapter implements OnClickListener { // Deklarasi Variabel private Activity activity; private ArrayList> data; private static LayoutInflater inflater = null; public Resources res; Posyandu tempValues = null; int i = 0; // Konstruktor Adapter public PosyanduAdapter(Activity a, ArrayList> d, Resources resLocal) { // set variabel untuk adapter activity = a; data = d; res = resLocal; // layout inflater untuk layout xml inflater = (LayoutInflater) activity .getSystemService(Context.LAYOUT_INFLATER_SERVICE); }
// cari jumlah array data public int getCount() { if (data.size() <= 0) return 1; return data.size(); } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } // set variabel untuk menampung nilai pada layout public static class ViewHolder { public TextView tNama; public TextView tKetua; public TextView tJumlah; public ImageView image; } // set variabel untuk listview public View getView(int position, View convertView, ViewGroup parent) { View vi = convertView; ViewHolder holder; if (convertView == null) { // set layout inflater untuk row di listview vi = inflater.inflate(R.layout.single_posyandu, null); holder = new ViewHolder(); holder.tNama = (TextView) vi.findViewById(R.id.txt_nama_posyandu); holder.tKetua = (TextView) vi.findViewById(R.id.txt_ketua_posyandu); holder.tJumlah = (TextView) vi.findViewById(R.id.txt_jumlah_balita); holder.image = (ImageView) vi .findViewById(R.id.img_gambar_posyandu); vi.setTag(holder); } else holder = (ViewHolder) vi.getTag(); if (data.size() <= 0) { holder.tNama.setText("No Data"); } else { // ambil nilai dari array data
tempValues = null; tempValues = (Posyandu) data.get(position); // set variabel untuk menampung nilai dari array data holder.tNama.setText(tempValues.getPosyanduNama()); holder.tKetua.setText(tempValues.getPosyanduKetua()); holder.tJumlah.setText(tempValues.getPosyanduBalita()); holder.image.setImageResource(res.getIdentifier( "com.tugasakhir.src:drawable/" + tempValues.getImage(), null, null)); // set fungsi onclick pada listview vi.setOnClickListener(new OnItemClickListener(position)); } return vi; } @Override public void onClick(View v) { // cek apakah fungsi onclick dapat berjalan Log.v("OnClick: ", "Running"); } // class pada saat fungsi onclick berjalan private class OnItemClickListener implements OnClickListener { private int mPosition; OnItemClickListener(int position) { mPosition = position; } @Override public void onClick(View arg0) { DaftarPosyandu sct = (DaftarPosyandu) activity; // fungsi onclick didalam listview sct.onItemClick(mPosition); } } } 4.
VitaminAdapter.java package com.tugasakhir.adapter; import java.util.ArrayList; import com.tugasakhir.lib.Vitamin; import com.tugasakhir.src.DaftarVitamin; import com.tugasakhir.src.R;
import android.app.Activity; import android.content.Context; import android.content.res.Resources; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; public class VitaminAdapter extends BaseAdapter implements OnClickListener { // Deklarasi Variabel private Activity activity; private ArrayList> data; private static LayoutInflater inflater = null; public Resources res; Vitamin tempValues = null; int i = 0; // Konstruktor Adapter public VitaminAdapter(Activity a, ArrayList> d, Resources resLocal) { // set variabel untuk adapter activity = a; data = d; res = resLocal; // layout inflater untuk layout xml inflater = (LayoutInflater) activity .getSystemService(Context.LAYOUT_INFLATER_SERVICE); } // cari jumlah array data public int getCount() { if (data.size() <= 0) return 1; return data.size(); } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; }
// set variabel untuk menampung nilai pada layout public static class ViewHolder { public TextView tNama; public TextView tKeterangan; public ImageView image; } // set variabel untuk listview public View getView(int position, View convertView, ViewGroup parent) { View vi = convertView; ViewHolder holder; if (convertView == null) { // set layout inflater untuk row di listview vi = inflater.inflate(R.layout.single_vitamin, null); holder = new ViewHolder(); holder.tNama = (TextView) vi.findViewById(R.id.txt_nama_vitamin); holder.tKeterangan = (TextView) vi .findViewById(R.id.txt_keterangan_vitamin); holder.image = (ImageView) vi.findViewById(R.id.img_gambar_vitamin); vi.setTag(holder); } else holder = (ViewHolder) vi.getTag(); if (data.size() <= 0) { holder.tNama.setText("No Data"); } else { // ambil nilai dari array data tempValues = null; tempValues = (Vitamin) data.get(position); // set variabel untuk menampung nilai dari array data holder.tNama.setText(tempValues.getVitaminNama()); holder.tKeterangan.setText(tempValues.getVitaminKeterangan() .substring(0, 100) + ". Selengkapnya..."); holder.image.setImageResource(res.getIdentifier( "com.tugasakhir.src:drawable/" + tempValues.getImage(), null, null)); // set fungsi onclick pada listview vi.setOnClickListener(new OnItemClickListener(position)); } return vi; } @Override
public void onClick(View v) { // cek apakah fungsi onclick dapat berjalan Log.v("OnClick: ", "Running"); } // class pada saat fungsi onclick berjalan private class OnItemClickListener implements OnClickListener { private int mPosition; OnItemClickListener(int position) { mPosition = position; } @Override public void onClick(View arg0) { DaftarVitamin sct = (DaftarVitamin) activity; // fungsi onclick didalam listview sct.onItemClick(mPosition); } } }
com.tugasakhir.lib 1.
DataLoaderFragment.java package com.tugasakhir.lib; import android.app.Activity; import android.app.Fragment; import android.os.AsyncTask; public class DataLoaderFragment extends Fragment { /** * Classes wishing to be notified of loading progress/completion implement * this. */ public interface ProgressListener { /** * Notifies that the task has completed * * @param result * Double result of the task */ public void onCompletion(Double result); /** * Notifies of progress * * @param value * int value from 0-100 */ public void onProgressUpdate(int value); } private ProgressListener mProgressListener; private Double mResult = Double.NaN; private LoadingTask mTask; @Override public void onAttach(Activity activity) { super.onAttach(activity); // Keep this Fragment around even during config changes setRetainInstance(true); } /** * Returns the result or {@value Double#NaN} * * @return the result or {@value Double#NaN} */ public Double getResult() { return mResult; }
/** * Returns true if a result has already been calculated * * @return true if a result has already been calculated * @see #getResult() */ public boolean hasResult() { return !Double.isNaN(mResult); } /** * Removes the ProgressListener * * @see #setProgressListener(ProgressListener) */ public void removeProgressListener() { mProgressListener = null; } /** * Sets the ProgressListener to be notified of updates * * @param listener * ProgressListener to notify * @see #removeProgressListener() */ public void setProgressListener(ProgressListener listener) { mProgressListener = listener; } /** * Starts loading the data */ public void startLoading() { mTask = new LoadingTask(); mTask.execute(); } private class LoadingTask extends AsyncTask
{ @Override protected Double doInBackground(Void... params) { double result = 0; for (int i = 0; i < 100; i++) { try { result += Math.sqrt(i); Thread.sleep(50); this.publishProgress(i); } catch (InterruptedException e) { return null; }
} return Double.valueOf(result); } @Override protected void onPostExecute(Double result) { mResult = result; mTask = null; if (mProgressListener != null) { mProgressListener.onCompletion(mResult); } } @Override protected void onProgressUpdate(Integer... values) { if (mProgressListener != null) { mProgressListener.onProgressUpdate(values[0]); } } } } 2.
SplashScreenFragment.java package com.tugasakhir.lib; import com.tugasakhir.src.R; import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ProgressBar; public class SplashScreenFragment extends Fragment { private ProgressBar mProgressBar; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.fragment_main, container, false); mProgressBar = (ProgressBar) view.findViewById(R.id.progress_bar); return view; } /** * Sets the progress of the ProgressBar * * @param progress * int the new progress between 0 and 100
*/ public void setProgress(int progress) { mProgressBar.setProgress(progress); } } 3.
KeteranganVitamin.java package com.tugasakhir.lib; public class KeteranganVitamin { // deklarasi variabel String code = null; String name = null; String continent = null; String region = null; // inisialisasi variabel public KeteranganVitamin(String code, String name, String continent, String region) { super(); this.code = code; this.name = name; this.continent = continent; this.region = region; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getContinent() { return continent; } public void setContinent(String continent) { this.continent = continent; } public String getRegion() { return region; } public void setRegion(String region) { this.region = region;
} @Override public String toString() { return code + " " + name + " " + continent + " " + region; } } 4.
PemberianVitamin.java package com.tugasakhir.lib; public class PemberianVitamin { // deklarasi variabel private int PemberianVitaminId; private String PemberianVitaminPosyandu; private String PemberianVitaminBalita; private String PemberianVitaminUmur; private String PemberianVitaminIbu; // inisialisasi fungsi set public void setPemberianVitaminId(int PemberianVitaminId) { this.PemberianVitaminId = PemberianVitaminId; } public void setPemberianVitaminPosyandu(String PemberianVitaminPosyandu) { this.PemberianVitaminPosyandu = PemberianVitaminPosyandu; } public void setPemberianVitaminBalita(String PemberianVitaminBalita) { this.PemberianVitaminBalita = PemberianVitaminBalita; } public void setPemberianVitaminUmur(String PemberianVitaminUmur) { this.PemberianVitaminUmur = PemberianVitaminUmur; } public void setPemberianVitaminIbu(String PemberianVitaminIbu) { this.PemberianVitaminIbu = PemberianVitaminIbu; } // inisialisasi fungsi get public int getPemberianVitaminId() { return this.PemberianVitaminId; } public String getPemberianVitaminPosyandu() { return this.PemberianVitaminPosyandu; } public String getPemberianVitaminBalita() { return this.PemberianVitaminBalita; } public String getPemberianVitaminUmur() { return this.PemberianVitaminUmur; }
public String getPemberianVitaminIbu() { return this.PemberianVitaminIbu; } } 5.
Posyandu.java package com.tugasakhir.lib; public class Posyandu { // deklarasi variabel private int PosyanduId; private String PosyanduNama; private String PosyanduKetua; private String PosyanduBalita; private String Image; // inisialisasi fungsi set public void setPosyanduId(int PosyanduId) { this.PosyanduId = PosyanduId; } public void setPosyanduNama(String PosyanduNama) { this.PosyanduNama = PosyanduNama; } public void setPosyanduKetua(String PosyanduKetua) { this.PosyanduKetua = PosyanduKetua; } public void setPosyanduBalita(String PosyanduBalita) { this.PosyanduBalita = PosyanduBalita; } public void setImage(String Image) { this.Image = Image; } // inisialisasi fungsi get public int getPosyanduId() { return this.PosyanduId; } public String getPosyanduNama() { return this.PosyanduNama; } public String getPosyanduKetua() { return this.PosyanduKetua; } public String getPosyanduBalita() { return this.PosyanduBalita; } public String getImage() { return this.Image; }
} 6.
Vitamin.java package com.tugasakhir.lib; public class Vitamin { // deklarasi variabel private int VitaminId; private String VitaminNama; private String VitaminKeterangan; private String Image; // inisialisasi fungsi set public void setVitaminId(int VitaminId) { this.VitaminId = VitaminId; } public void setVitaminNama(String VitaminNama) { this.VitaminNama = VitaminNama; } public void setVitaminKeterangan(String VitaminKeterangan) { this.VitaminKeterangan = VitaminKeterangan; } public void setImage(String Image) { this.Image = Image; } // inisialisasi fungsi get public int getVitaminId() { return this.VitaminId; } public String getVitaminNama() { return this.VitaminNama; } public String getVitaminKeterangan() { return this.VitaminKeterangan; } public String getImage() { return this.Image; }
7.
} Variables.java package com.tugasakhir.lib; public class Variables { // Set Variabel Untuk Posyandu public static final int ID_POSYANDU_1 = 1; public static final String NAMA_POSYANDU_1 = "MELATI I"; public static final String KETUA_POSYANDU_1 = "IBU MASRIPEH"; public static final String DESA_POSYANDU_1 = "DESA CIKUPA"; public static final String ALAMAT_POSYANDU_1 = "RT/RW 04/02 KP.DUKUH KEC.CIKUPA KAB.TANGERANG"; public static final String JUMLAH_BALITA_1 = "44 Balita";
public static final String GAMBAR_POSYANDU_1 = "posyandu1"; public static final int ID_POSYANDU_2 = 2; public static final String NAMA_POSYANDU_2 = "MELATI II"; public static final String KETUA_POSYANDU_2 = "IBU DIAN"; public static final String DESA_POSYANDU_2 = "DESA CIKUPA"; public static final String ALAMAT_POSYANDU_2 = "RT/RW 02/03 KP.CIREWED KEC.CIKUPA KAB.TANGERANG"; public static final String JUMLAH_BALITA_2 = "68 Balita"; public static final String GAMBAR_POSYANDU_2 = "posyandu2"; public static final int ID_POSYANDU_3 = 3; public static final String NAMA_POSYANDU_3 = "MELATI III"; public static final String KETUA_POSYANDU_3 = "IBU IIS"; public static final String DESA_POSYANDU_3 = "DESA CIKUPA"; public static final String ALAMAT_POSYANDU_3 = "RT/RW 03/01 DS.SUKAMULYA KEC.CIKUPA KAB.TANGERANG"; public static final String JUMLAH_BALITA_3 = "89 Balita"; public static final String GAMBAR_POSYANDU_3 = "posyandu3"; public public public public public GADUNG public public
static static static static static CIKUPA static static
final int ID_POSYANDU_4 = 4; final String NAMA_POSYANDU_4 = "MELATI IV"; final String KETUA_POSYANDU_4 = "IBU NANI"; final String DESA_POSYANDU_4 = "DESA CIKUPA"; final String ALAMAT_POSYANDU_4 = "RT/RW 01/04 KEC.CIKUPA KAB.TANGERANG"; final String JUMLAH_BALITA_4 = "67 Balita"; final String GAMBAR_POSYANDU_4 = "posyandu4";
PASIR
public static final int ID_POSYANDU_5 = 5; public static final String NAMA_POSYANDU_5 = "MELATI V"; public static final String KETUA_POSYANDU_5 = "IBU WIWIT"; public static final String DESA_POSYANDU_5 = "DESA CIKUPA"; public static final String ALAMAT_POSYANDU_5 = "RT/RW 15/02 KP.LAMPORA KEC.CIKUPA KAB.TANGERANG"; public static final String JUMLAH_BALITA_5 = "65 Balita"; public static final String GAMBAR_POSYANDU_5 = "posyandu5"; // Set Variabel Untuk Vitamin public static final int ID_VITAMIN_1 = 1; public static final String NAMA_VITAMIN_1 = "Vitamin A atau Retinol"; public static final String KETERANGAN_VITAMIN_1 = "Vitamin A adalah salah satu vitamin yang dibutuhkan oleh tubuh. Vitamin A ini mempunyai banyak fungsi untuk tubuh anda, beberapa fungsinya seperti anti oksidan, memerangi sakit malaria, anti aging, meningkatkan daya tahan tubuh, dan untuk para ibu hamil vitamin A ini mampu mengoptimalkan perkembangan janin anda. Anda bisa mendapatkan sumber Vitamin A ini pada hati, minyak ikan, daging, susu, wortel, sayuran dan buah yang berbau warna oranye. Jika anda kekuarang vitamin A, akan ada akibatnya dalam tubuh anda misalnya rabun senja, katarak, dan juga daya tahan tubuh yang menurun serta kulit yang tidak sehat."; public static final String GAMBAR_VITAMIN_1 = "vitamin_a"; public static final String KEBUTUHAN_VITAMIN_1 = "Fungsi: mengoptimalkan perkembangan janin, meningkatkan daya tahan tubuh, anti aging, anti oksidan dan memerangi penyakit malaria. \nKebutuhan: Anak balita adalah 500 – 600 µg RE/ hari. \nSumber:
hati, minyak ikan, daging, susu, wortel, serta sayuran dan buah berwarna orange."; public static final int ID_VITAMIN_2 = 2; public static final String NAMA_VITAMIN_2 = "Vitamin B1 atau Thiamin"; public static final String KETERANGAN_VITAMIN_2 = "Vitamin B1 atau bahasa lainnya disebut Thiamin. Thiamin ini mempunyai fungsi membantu proses oksidasi dalam tubuh untuk memperoleh energi. Anda akan sangat membutuhkan vitamin B1 untuk tubuh anda, dan anda bisa mendapatkannya di dalam daging, roti, sayuran, kulit besar, dan juga kacang hijau. Jika anda kekurangan vitamin B1, maka akan berdampak pada kulit anda yang akan kering dan bersisik."; public static final String GAMBAR_VITAMIN_2 = "vitamin_b1"; public static final String KEBUTUHAN_VITAMIN_2 = "Fungsi: Mengubah zat karbohidrat dalam makanan menjadi energi. \nKebutuhan: Anak balita adalah 0,5 – 0,6 mg /hari. \nSumber: Nasi, roti, sereal, tepung terigu, makanan laut seperti udang, kepiting atau kerang."; public static final int ID_VITAMIN_3 = 3; public static final String NAMA_VITAMIN_3 = "Vitamin B2 atau Riboflavin"; public static final String KETERANGAN_VITAMIN_3 = "Vitamin B2 yang berfungsi untuk menjaga keutuhan jaringan saraf dan mempercepat pemindahan rangsang sinar ke saraf mata. Vitamin B2 ini bisa kita dapatkan dalam makanan seperti hati, telur, susu dan ragi. Jika anda kekurangan mengkonsumsi makanan yang mengandung vitamin B2 bisa mengakibatkan penurunan daya tahan tubuh dan menyebabkan penyakit seperti sariawan, bibir pecah-pecah dsb."; public static final String GAMBAR_VITAMIN_3 = "vitamin_b2"; public static final String KEBUTUHAN_VITAMIN_3 = "Fungsi: Menjaga kesehatan mata dan kulit. \nKebutuhan: Anak balita adalah 0,6 – 0,8 mg/hari. \nSumber: Susu, keju, ayam, brokoli, bayam, jamur."; public static final int ID_VITAMIN_4 = 4; public static final String NAMA_VITAMIN_4 = "Vitamin B3 (Niasin)"; public static final String KETERANGAN_VITAMIN_4 = "Vitamin B3 ini bermanfaat untuk membantu penguraian energy dari makanan dan sStringesis asam lemak. Jika anda kekurangan vitamin tersebut makan bisa mengakibatkan insomnia, badan mudah lemas, otot mudah kejang dan keram, terganggunya system pencernaan setra mudah muntah-muntah juga mual. Jenis vitamin ini bisa anda dapat dari makanan seperti hati, jamur dan kacang-kacangan."; public static final String GAMBAR_VITAMIN_4 = "vitamin_b3"; public static final String KEBUTUHAN_VITAMIN_4 = "Fungsi: Untuk kesehatan kulit, meningkatkan nafsu makan, memperbaiki sistem pencernaan serta membantu mengubah makanan menjadi energi. \nKebutuhan: Anak balita adalah 8 – 10 mg/hari. \nSumber: Padipadian, kacang-kacangan, daging sapi, jamur."; public static final int ID_VITAMIN_5 = 5; public static final String NAMA_VITAMIN_5 = "Vitamin B5 (asam pantotenat)"; public static final String KETERANGAN_VITAMIN_5 = "Vitamin B5 berfungsiuntuk membantu memperlancar proses metabolsime karbohidrat, protein dan lemak dalam tubuh. Jika anda kekurangan vitamin B5 maka bisa mengakibatkan otot mudah mengalami kram, insomnia atau sulit tidur, gangguan emosi dsb. Vitamin jenis ini bisa kita dapat dari
jenis makanan seperti daging, susu, sayur hijau, ginjal, hati dan kacang hijau."; public static final String GAMBAR_VITAMIN_5 = "vitamin_b5"; public static final String KEBUTUHAN_VITAMIN_5 = "Fungsi: Vitamin B5 berguna dalam proses pemecahan lemak, protein, karbohidrat menjadi energi. Manfaat lainnya adalah untuk pembentukan sel darah merah dan membuat vitamin D. \nKebutuhan: Anak balita adalah 600 – 800 µg RE/ hari. \nSumber: Ayam, ikan sarden, alpukat, semangka."; public static final int ID_VITAMIN_6 = 6; public static final String NAMA_VITAMIN_6 = "Vitamin B6 (pridoksin)"; public static final String KETERANGAN_VITAMIN_6 = "Vitamin B6 merupakan jenis vitamin yang berfungsi untuk membantu proses pencernaan protein dan respirasi selular. Kekurangan vitamin B6 bisa menyebabkan pelagra (kulit pecah-pecah), keram pada otot dan insomnia (sulit tidur). Jenis vitamin tersebut bisa anda dapatkan dari jenis makanan seperti, telur, daging, kentang dan kubis dsb."; public static final String GAMBAR_VITAMIN_6 = "vitamin_b6"; public static final String KEBUTUHAN_VITAMIN_6 = "Fungsi: Diperlukan dalam proses asam amino dan lemak. \nKebutuhan: Anak balita adalah 0,9 – 1,3 mg/hari. \nSumber: Daging unggas, ikan, sapi, kentang, tomat, pisang, buah yang berwarna ungu dan sayuran hijau."; public static final int ID_VITAMIN_7 = 7; public static final String NAMA_VITAMIN_7 = "Vitamin B7 (Biotin)"; public static final String KETERANGAN_VITAMIN_7 = "Berfungsi untuk membantu memperlancar proses metabolisme Energi, pertumbuhan rambut dan kuku, menurunkan berat badan dan menjaga kadar gula dalam darah. Kekurangan vitamin B7 dapat menimbulkan penyakit Dermatitis, Hyperesthesia dan Paresthesia, Keratokonjungtivitis, Anorexia, Anemia dan terganggunya fungsi jantung. Jneis vitamin ini bisa didapat dari jenis makanan seperti roti gandum, telur ayam, wortel, susu, keju, ikan salmon dan kacang-kacangan."; public static final String GAMBAR_VITAMIN_7 = "vitamin_b7"; public static final String KEBUTUHAN_VITAMIN_7 = "Fungsi: Membantu dalam proses pemecahan lemak, protein menjadi energi yang akan digunakan oleh tubuh. \nKebutuhan: Anak balita adalah 400 – 700 µg RE/ hari. \nSumber: Daging ikan salmon, telur, susu, sereal, pisang dan kacang tanah."; public static final int ID_VITAMIN_8 = 8; public static final String NAMA_VITAMIN_8 = "Vitamin B9 (Asam Folat)"; public static final String KETERANGAN_VITAMIN_8 = "Asam folt (Vitamin B9) berfungsi untuk pembentukan sel darah merah, perbaikan DNA, Perkembangan bayi, pembentukan jaringan tubuh, mengoptimalkan fungsi otak, pertumbuhan rambut. Kekurangan vitamin B9 dapat menyebabkan gangguan fungsi otak, pertumbuhan tulang belakang, sariawan, diare, dll. Jenis vitamin ini bisa kita dapat dari jenis makanan seperti selada, bayam, asparagus, semangka, belewah, biji bunga matahari, kacang-kacangan, hati dan kuning telur."; public static final String GAMBAR_VITAMIN_8 = "vitamin_b9"; public static final String KEBUTUHAN_VITAMIN_8 = "Fungsi: Bertugas agar sel-sel pada tubuh berkembang dengan benar, membentuk sel darah merah dan mencegah kerusakan saraf pada janin. \nKebutuhan: Anak balita adalah 100 – 200 µg/hari. \nSumber: Susu dan produk olahan susu, bit, hati, melon dan sayuran berdaun hijau.";
public static final int ID_VITAMIN_9 = 9; public static final String NAMA_VITAMIN_9 = "Vitamin B12 (kobalamin)"; public static final String KETERANGAN_VITAMIN_9 = "Kobaamin atau vitamin B12 berfungsi untuk membantu proses pembentukan sel darah merah, sStringesis asam nukleat dan pembelahan sel. Kekurangan vitamin B12 menyebabkan anemia (kurang darah) dan mudah lelah. Kita bisa memperoleh vitamin jenis ini dari makanan seperti daging, telur, susu, hati dan ragi (makanan hasil fermentasi)."; public static final String GAMBAR_VITAMIN_9 = "vitamin_b12"; public static final String KEBUTUHAN_VITAMIN_9 = "Fungsi: Mengubah karbohidrat, protein dan lemak menjadi energi, menjaga sel darah merah tetap sehat, melindungi sel saraf, mencegah penyakit jantung, dan mencegah penyusutan otak yang dapat menyebabkan daya ingat menurun. \nKebutuhan: Anak balita adalah 2,0 – 2,5 µg/hari. \nSumber: Daging sapi, daging ikan, hati, telur, susu, kedelai dan rumput laut."; public static final int ID_VITAMIN_10 = 10; public static final String NAMA_VITAMIN_10 = "Vitamin C atau Asam Askorbat"; public static final String KETERANGAN_VITAMIN_10 = "Vitamin C adalah salah satu vitamin yang paling sering kita dengar diantara jenis vitamin yang lainnya. Vitamin C sendiri memiliki fungsi untuk menurunkan kolestrol, mencegah adanya penyakit jantung, mencegah penyakit kanker, diabetes melitus, hipertensi, dan juga mampu untuk menjaga daya tahan tubuh agar tidak terinfeksi racun. Jika anda kekurangan vitamin C akan berakibat rasa nyeri pada persendian anda, gusi yang mudah berdarah, dan daya tahan tubuh yang lemah sehingga mudah terinfeksi pada luka."; public static final String GAMBAR_VITAMIN_10 = "vitamin_c"; public static final String KEBUTUHAN_VITAMIN_10 = "Fungsi: menjaga ketahanan tubuh terhadap penyakit infeksi dan racun, menurunkan kolesterol, serta mencegah penyakit jantung (dalam dosis tinggi), hipertensi, diabetes melitus dan kanker. \nKebutuhan: Anak balita adalah 20 mg/hari. \nSumber: buah-buahan misalnya jeruk, tomat, pepaya dan sayuran hijau lainnya"; public static final int ID_VITAMIN_11 = 11; public static final String NAMA_VITAMIN_11 = "Vitamin D atau Kalsiferol"; public static final String KETERANGAN_VITAMIN_11 = "Vitamin D ini mempunyai fungsi yang lebih mengarah pada tulang dan gigi anda. fungsi dari vitamin D yaitu untuk meningkatkan penyerapan kalsium dan fosfor bagi tulang dan gigi anda. Jika anda kekurangan vitamin D ini maka akan berakibat gigi anda akan rusak dan tidak kuat, kejang – kejang pada otot, dan juga rakitis ( atau kaki yang berbentuk O ). Anda bisa mendapatkan vitamin D ini pada kuning telur, susu, dan juga minyak ikan."; public static final String GAMBAR_VITAMIN_11 = "vitamin_d"; public static final String KEBUTUHAN_VITAMIN_11 = "Fungsi: meningkatkan penyerapan kalsium dan fosfor untuk kesehatan tulang dan gigi. \nKebutuhan: Anak balita adalah 500 mg/hari. \nSumber: susu, minyak ikan, dam kuning telur."; public static final int ID_VITAMIN_12 = 12; public static final String NAMA_VITAMIN_12 = "Vitamin E atau Tokoferol";
public static final String KETERANGAN_VITAMIN_12 = "Vitamin E atau Tokoferol adalah salah satu vitamin yang dibutuhkan oleh tubuh. Jika anda ingin mendapatkan vitamin E dan menikmati fungsinya anda bisa mendapatkannya pada sayur, mentega, susu, dan juga biji – bijian. Jika anda kekuarang vitamin E, ini akan menyebabkan kemandulan pada anda. Sedangkan fungsi yang dimiliki oleh vitamin E ini adalah berperan penting dalam proses reproduksi dan juga mampu untuk mencegah kanker paru – paru. Jadi vitamin E juga merupakan vitamin yang paling penting untuk tubuh dan kesehatan anda."; public static final String GAMBAR_VITAMIN_12 = "vitamin_e"; public static final String KEBUTUHAN_VITAMIN_12 = "Fungsi: berberan penting dalam sistem reproduksi dan mencegah penyakit kanker paruparu. \nKebutuhan: Anak balita adalah 8 mg/hari. \nSumber: bijibijian, sayuran, telur, mentega dan susu."; public static final int ID_VITAMIN_13 = 13; public static final String NAMA_VITAMIN_13 = "Vitamin K atau Koagulasi"; public static final String KETERANGAN_VITAMIN_13 = "Vitamin K mempunyai fungsi sebagai pembekuan darah dan mencegah keguguran. Anda bisa mendapatkan vitamin K pada sayur bayam, tomat, dan juga wortel. Jika anda kekurangan vitamin K, makan akan berdampak darah akan sulit membeku jika anda terluka dan akan terjadi pendarahan dalam tubuh anda."; public static final String GAMBAR_VITAMIN_13 = "vitamin_k"; public static final String KEBUTUHAN_VITAMIN_13 = "Fungsi: berperan dalam pembekuan darah dan dapat mencegah keguguran. \nKebutuhan: Anak balita adalah 8 - 100 mg/hari. \nSumber: bayam, tomat, wortel."; // Set Variabel Untuk Pemberian Vitamin public static final int PEMBERIAN_VITAMIN_ID_1 = 1; public static final String PEMBERIAN_VITAMIN_POSYANDU_1 = "MELATI I"; public static final String PEMBERIAN_VITAMIN_BALITA_1 = "LATIF"; public static final String PEMBERIAN_VITAMIN_UMUR_1 = "8"; public static final String PEMBERIAN_VITAMIN_IBU_1 = "IBU SRI"; public static final String PEMBERIAN_VITAMIN_ALAMAT_1 = "KP.DUKUH KEC.CIKUPA KAB.TANGERANG RT/RW 04/02"; public static final String PEMBERIAN_VITAMIN_1_KAPSULBIRU_1 = "23/Feb/2013"; public static final String PEMBERIAN_VITAMIN_1_KAPSULMERAH_1 = "23/Aug/2013"; public static final String PEMBERIAN_VITAMIN_1_KAPSULMERAH_2 = "23/Feb/2014"; public static final String PEMBERIAN_VITAMIN_1_KAPSULMERAH_3 = ""; public static final String PEMBERIAN_VITAMIN_1_KAPSULMERAH_4 = ""; public static final int PEMBERIAN_VITAMIN_ID_2 = 2; public static final String PEMBERIAN_VITAMIN_POSYANDU_2 = "MELATI II"; public static final String PEMBERIAN_VITAMIN_BALITA_2 = "RIFKI RIYADI"; public static final String PEMBERIAN_VITAMIN_UMUR_2 = "9"; public static final String PEMBERIAN_VITAMIN_IBU_2 = "IBU DIANA"; public static final String PEMBERIAN_VITAMIN_ALAMAT_2 = "KP.CIREWED KEC.CIKUPA KAB.TANGERANG RT/RW 02/03"; public static final String PEMBERIAN_VITAMIN_2_KAPSULBIRU_1 = "25/Feb/2013";
public static final "25/Aug/2013"; public static final "25/Feb/2014"; public static final public static final
String PEMBERIAN_VITAMIN_2_KAPSULMERAH_1 = String PEMBERIAN_VITAMIN_2_KAPSULMERAH_2 = String PEMBERIAN_VITAMIN_2_KAPSULMERAH_3 = ""; String PEMBERIAN_VITAMIN_2_KAPSULMERAH_4 = "";
public static final int PEMBERIAN_VITAMIN_ID_3 = 3; public static final String PEMBERIAN_VITAMIN_POSYANDU_3 = "MELATI III"; public static final String PEMBERIAN_VITAMIN_BALITA_3 = "SRI PUJAS TUTI"; public static final String PEMBERIAN_VITAMIN_UMUR_3 = "6"; public static final String PEMBERIAN_VITAMIN_IBU_3 = "IBU WIDIYANTI"; public static final String PEMBERIAN_VITAMIN_ALAMAT_3 = "DS.SUKAMULYA KEC.CIKUPA KAB.TANGERANG RT/RW 03/01"; public static final String PEMBERIAN_VITAMIN_3_KAPSULBIRU_1 = "27/Feb/2014"; public static final String PEMBERIAN_VITAMIN_3_KAPSULMERAH_1 = ""; public static final String PEMBERIAN_VITAMIN_3_KAPSULMERAH_2 = ""; public static final String PEMBERIAN_VITAMIN_3_KAPSULMERAH_3 = ""; public static final String PEMBERIAN_VITAMIN_3_KAPSULMERAH_4 = ""; public static final int PEMBERIAN_VITAMIN_ID_4 = 4; public static final String PEMBERIAN_VITAMIN_POSYANDU_4 = "MELATI IV"; public static final String PEMBERIAN_VITAMIN_BALITA_4 = "NURSAIDAH"; public static final String PEMBERIAN_VITAMIN_UMUR_4 = "9"; public static final String PEMBERIAN_VITAMIN_IBU_4 = "IBU MASRIPEH"; public static final String PEMBERIAN_VITAMIN_ALAMAT_4 = "KP.DUKUH KEC.CIKUPA KAB.TANGERANG RT/RW 04/02"; public static final String PEMBERIAN_VITAMIN_4_KAPSULBIRU_1 = "29/Aug/2013"; public static final String PEMBERIAN_VITAMIN_4_KAPSULMERAH_1 = "29/Feb/2014"; public static final String PEMBERIAN_VITAMIN_4_KAPSULMERAH_2 = ""; public static final String PEMBERIAN_VITAMIN_4_KAPSULMERAH_3 = ""; public static final String PEMBERIAN_VITAMIN_4_KAPSULMERAH_4 = ""; public static final int PEMBERIAN_VITAMIN_ID_5 = 5; public static final String PEMBERIAN_VITAMIN_POSYANDU_5 = "MELATI V"; public static final String PEMBERIAN_VITAMIN_BALITA_5 = "ADI GUNAWAN"; public static final String PEMBERIAN_VITAMIN_UMUR_5 = "10"; public static final String PEMBERIAN_VITAMIN_IBU_5 = "IBU SUMIYATI"; public static final String PEMBERIAN_VITAMIN_ALAMAT_5 = "KP.LAMPORA KEC.CIKUPA KAB.TANGERANG"; public static final String PEMBERIAN_VITAMIN_5_KAPSULBIRU_1 = "20/Aug/2013"; public static final String PEMBERIAN_VITAMIN_5_KAPSULMERAH_1 = "20/Feb/2014"; public static final String PEMBERIAN_VITAMIN_5_KAPSULMERAH_2 = ""; public static final String PEMBERIAN_VITAMIN_5_KAPSULMERAH_3 = ""; public static final String PEMBERIAN_VITAMIN_5_KAPSULMERAH_4 = ""; }
com.tugasakhir.src 1. DaftarPemberianVitamin.java package com.tugasakhir.src; import java.util.ArrayList; import import import import import import import import import import
android.app.Activity; android.content.Intent; android.content.res.Resources; android.os.Bundle; android.view.Menu; android.view.MenuItem; android.view.View; android.view.View.OnClickListener; android.widget.Button; android.widget.ListView;
import com.tugasakhir.adapter.PemberianVitaminAdapter; import com.tugasakhir.lib.PemberianVitamin; import com.tugasakhir.lib.Variables; public class DaftarPemberianVitamin extends Activity { // deklarasi widget private Button bKembali; private ListView lView; PemberianVitaminAdapter adapter; public DaftarPemberianVitamin CustomListView = null; public ArrayList CustomListViewValuesArr = new ArrayList(); private private private private private
int ID; String POSYANDU; String BALITA; String UMUR; String IBU;
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.daftar_pemberian_vitamin); CustomListView = this; /******** Take some data in Arraylist ( CustomListViewValuesArr ) ***********/ setListData(); Resources res = getResources(); lView = (ListView) findViewById(R.id.listPemberianVitamin); /**************** Create Custom Adapter *********/ adapter = new PemberianVitaminAdapter(CustomListView, CustomListViewValuesArr, res); lView.setAdapter(adapter); bKembali = (Button) findViewById(R.id.btn_kembali); bKembali.setOnClickListener(new OnClickListener() {
@Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(DaftarPemberianVitamin.this, MenuActivity.class); startActivity(intent); finish(); } }); } /***************** This function used by adapter ****************/ public void onItemClick(int mPosition) { PemberianVitamin tempValues = (PemberianVitamin) CustomListViewValuesArr .get(mPosition); int id_pemberian_vitamin = tempValues.getPemberianVitaminId(); // intent to detail category Intent iDetail = new Intent(getBaseContext(), DetailPemberianVitamin.class); iDetail.putExtra("id_pemberian_vitamin", String.valueOf(id_pemberian_vitamin)); startActivity(iDetail); finish(); } /****** Function to set data in ArrayList *************/ public void setListData() { for (int i = 1; i < 6; i++) { switch (i) { case 1: ID = Variables.PEMBERIAN_VITAMIN_ID_1; POSYANDU = Variables.PEMBERIAN_VITAMIN_POSYANDU_1; BALITA = Variables.PEMBERIAN_VITAMIN_BALITA_1; UMUR = Variables.PEMBERIAN_VITAMIN_UMUR_1; IBU = Variables.PEMBERIAN_VITAMIN_IBU_1; break; case 2: ID = Variables.PEMBERIAN_VITAMIN_ID_2; POSYANDU = Variables.PEMBERIAN_VITAMIN_POSYANDU_2; BALITA = Variables.PEMBERIAN_VITAMIN_BALITA_2; UMUR = Variables.PEMBERIAN_VITAMIN_UMUR_2; IBU = Variables.PEMBERIAN_VITAMIN_IBU_2; break; case 3: ID = Variables.PEMBERIAN_VITAMIN_ID_3; POSYANDU = Variables.PEMBERIAN_VITAMIN_POSYANDU_3; BALITA = Variables.PEMBERIAN_VITAMIN_BALITA_3; UMUR = Variables.PEMBERIAN_VITAMIN_UMUR_3; IBU = Variables.PEMBERIAN_VITAMIN_IBU_3;
break; case 4: ID = Variables.PEMBERIAN_VITAMIN_ID_4; POSYANDU = Variables.PEMBERIAN_VITAMIN_POSYANDU_4; BALITA = Variables.PEMBERIAN_VITAMIN_BALITA_4; UMUR = Variables.PEMBERIAN_VITAMIN_UMUR_4; IBU = Variables.PEMBERIAN_VITAMIN_IBU_4; break; case 5: ID = Variables.PEMBERIAN_VITAMIN_ID_5; POSYANDU = Variables.PEMBERIAN_VITAMIN_POSYANDU_5; BALITA = Variables.PEMBERIAN_VITAMIN_BALITA_5; UMUR = Variables.PEMBERIAN_VITAMIN_UMUR_5; IBU = Variables.PEMBERIAN_VITAMIN_IBU_5; break; } final PemberianVitamin lsPemberianVitamin = new PemberianVitamin(); /******* Firstly take data in model object ******/ lsPemberianVitamin.setPemberianVitaminId(ID); lsPemberianVitamin.setPemberianVitaminPosyandu(POSYANDU); lsPemberianVitamin.setPemberianVitaminBalita(BALITA); lsPemberianVitamin.setPemberianVitaminUmur(UMUR); lsPemberianVitamin.setPemberianVitaminIbu(IBU); /******** Take Model Object in ArrayList **********/ CustomListViewValuesArr.add(lsPemberianVitamin); } } @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 boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.kebutuhan_vitamin) { Intent iKebutuhanVitamin = new Intent(DaftarPemberianVitamin.this, KebutuhanVitamin.class); finish(); startActivity(iKebutuhanVitamin); return true; } else if (id == R.id.daftar_posyandu) { Intent iDaftarPosyandu = new Intent(DaftarPemberianVitamin.this, DaftarPosyandu.class);
finish(); startActivity(iDaftarPosyandu); return true; } else if (id == R.id.daftar_vitamin) { Intent iDaftarVitamin = new Intent(DaftarPemberianVitamin.this, DaftarVitamin.class); finish(); startActivity(iDaftarVitamin); return true; } else if (id == R.id.informasi) { Intent iPengembang = new Intent(DaftarPemberianVitamin.this, InfoActivity.class); finish(); startActivity(iPengembang); return true; } else if (id == R.id.keluar) { finish(); return true; } else { return super.onOptionsItemSelected(item); } } } 2. DaftarPosyandu.java package com.tugasakhir.src; import java.util.ArrayList; import import import import import import import import import import
android.app.Activity; android.content.Intent; android.content.res.Resources; android.os.Bundle; android.view.Menu; android.view.MenuItem; android.view.View; android.view.View.OnClickListener; android.widget.Button; android.widget.ListView;
import com.tugasakhir.adapter.PosyanduAdapter; import com.tugasakhir.lib.Posyandu; import com.tugasakhir.lib.Variables; public class DaftarPosyandu extends Activity { // deklarasi widget private Button bKembali; private ListView lView; PosyanduAdapter adapter; public DaftarPosyandu CustomListView = null; public ArrayList CustomListViewValuesArr = new ArrayList(); private int ID; private String NAMA;
private String KETUA; private String JUMLAH; private String GAMBAR; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.daftar_posyandu); CustomListView = this; /******** Take some data in Arraylist ( CustomListViewValuesArr ) ***********/ setListData(); Resources res = getResources(); lView = (ListView) findViewById(R.id.list_posyandu); /**************** Create Custom Adapter *********/ adapter = new PosyanduAdapter(CustomListView, CustomListViewValuesArr, res); lView.setAdapter(adapter); bKembali = (Button) findViewById(R.id.btn_kembali); bKembali.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(DaftarPosyandu.this, MenuActivity.class); startActivity(intent); finish(); } }); } /***************** This function used by adapter ****************/ public void onItemClick(int mPosition) { Posyandu tempValues = (Posyandu) CustomListViewValuesArr.get(mPosition); int id_posyandu = tempValues.getPosyanduId(); // intent to detail category Intent iDetail = new Intent(getBaseContext(), DetailPosyandu.class); iDetail.putExtra("id_posyandu", String.valueOf(id_posyandu)); startActivity(iDetail); finish(); } /****** Function to set data in ArrayList *************/ public void setListData() { for (int i = 1; i < 6; i++) { switch (i) {
case 1: ID = Variables.ID_POSYANDU_1; NAMA = Variables.NAMA_POSYANDU_1; KETUA = Variables.KETUA_POSYANDU_1; JUMLAH = Variables.JUMLAH_BALITA_1; GAMBAR = Variables.GAMBAR_POSYANDU_1; break; case 2: ID = Variables.ID_POSYANDU_2; NAMA = Variables.NAMA_POSYANDU_2; KETUA = Variables.KETUA_POSYANDU_2; JUMLAH = Variables.JUMLAH_BALITA_2; GAMBAR = Variables.GAMBAR_POSYANDU_2; break; case 3: ID = Variables.ID_POSYANDU_3; NAMA = Variables.NAMA_POSYANDU_3; KETUA = Variables.KETUA_POSYANDU_3; JUMLAH = Variables.JUMLAH_BALITA_3; GAMBAR = Variables.GAMBAR_POSYANDU_3; break; case 4: ID = Variables.ID_POSYANDU_4; NAMA = Variables.NAMA_POSYANDU_4; KETUA = Variables.KETUA_POSYANDU_4; JUMLAH = Variables.JUMLAH_BALITA_4; GAMBAR = Variables.GAMBAR_POSYANDU_4; break; case 5: ID = Variables.ID_POSYANDU_5; NAMA = Variables.NAMA_POSYANDU_5; KETUA = Variables.KETUA_POSYANDU_5; JUMLAH = Variables.JUMLAH_BALITA_5; GAMBAR = Variables.GAMBAR_POSYANDU_5; break; } final Posyandu lsPosyandu = new Posyandu(); /******* Firstly take data in model object ******/ lsPosyandu.setPosyanduId(ID); lsPosyandu.setPosyanduNama(NAMA); lsPosyandu.setPosyanduKetua(KETUA); lsPosyandu.setPosyanduBalita(JUMLAH); lsPosyandu.setImage(GAMBAR); /******** Take Model Object in ArrayList **********/ CustomListViewValuesArr.add(lsPosyandu); } } @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 boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.kebutuhan_vitamin) { Intent iKebutuhanVitamin = new Intent(DaftarPosyandu.this, KebutuhanVitamin.class); finish(); startActivity(iKebutuhanVitamin); return true; } else if (id == R.id.daftar_vitamin) { Intent iDaftarVitamin = new Intent(DaftarPosyandu.this, SplashVitamin.class); finish(); startActivity(iDaftarVitamin); return true; } else if (id == R.id.daftar_pemberian_vitamin) { Intent iDaftarPemberianVitamin = new Intent(DaftarPosyandu.this, SplashPemberianVitamin.class); finish(); startActivity(iDaftarPemberianVitamin); return true; } else if (id == R.id.informasi) { Intent iPengembang = new Intent(DaftarPosyandu.this, InfoActivity.class); finish(); startActivity(iPengembang); return true; } else if (id == R.id.keluar) { finish(); return true; } else { return super.onOptionsItemSelected(item); } } } 3. DaftarVitamin.java package com.tugasakhir.src; import java.util.ArrayList; import import import import import import import import import import
android.app.Activity; android.content.Intent; android.content.res.Resources; android.os.Bundle; android.view.Menu; android.view.MenuItem; android.view.View; android.view.View.OnClickListener; android.widget.Button; android.widget.ListView;
import com.tugasakhir.adapter.VitaminAdapter; import com.tugasakhir.lib.Vitamin; import com.tugasakhir.lib.Variables;
public class DaftarVitamin extends Activity { // deklarasi widget private Button bKembali; private ListView lView; VitaminAdapter adapter; public DaftarVitamin CustomListView = null; public ArrayList CustomListViewValuesArr = new ArrayList(); private private private private
int ID; String NAMA; String KETERANGAN; String GAMBAR;
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.daftar_vitamin); CustomListView = this; /******** Take some data in Arraylist ( CustomListViewValuesArr ) ***********/ setListData(); Resources res = getResources(); lView = (ListView) findViewById(R.id.list_vitamin); /**************** Create Custom Adapter *********/ adapter = new VitaminAdapter(CustomListView, CustomListViewValuesArr, res); lView.setAdapter(adapter); bKembali = (Button) findViewById(R.id.btn_kembali); bKembali.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(DaftarVitamin.this, MenuActivity.class); startActivity(intent); finish(); } }); } /***************** This function used by adapter ****************/ public void onItemClick(int mPosition) { Vitamin tempValues = (Vitamin) CustomListViewValuesArr.get(mPosition); int id_vitamin = tempValues.getVitaminId();
// intent to detail category Intent iDetail = new Intent(getBaseContext(), DetailVitamin.class); iDetail.putExtra("id_vitamin", String.valueOf(id_vitamin)); startActivity(iDetail); finish(); } /****** Function to set data in ArrayList *************/ public void setListData() { for (int i = 1; i < 14; i++) { switch (i) { case 1: ID = Variables.ID_VITAMIN_1; NAMA = Variables.NAMA_VITAMIN_1; KETERANGAN = Variables.KETERANGAN_VITAMIN_1; GAMBAR = Variables.GAMBAR_VITAMIN_1; break; case 2: ID = Variables.ID_VITAMIN_2; NAMA = Variables.NAMA_VITAMIN_2; KETERANGAN = Variables.KETERANGAN_VITAMIN_2; GAMBAR = Variables.GAMBAR_VITAMIN_2; break; case 3: ID = Variables.ID_VITAMIN_3; NAMA = Variables.NAMA_VITAMIN_3; KETERANGAN = Variables.KETERANGAN_VITAMIN_3; GAMBAR = Variables.GAMBAR_VITAMIN_3; break; case 4: ID = Variables.ID_VITAMIN_4; NAMA = Variables.NAMA_VITAMIN_4; KETERANGAN = Variables.KETERANGAN_VITAMIN_4; GAMBAR = Variables.GAMBAR_VITAMIN_4; break; case 5: ID = Variables.ID_VITAMIN_5; NAMA = Variables.NAMA_VITAMIN_5; KETERANGAN = Variables.KETERANGAN_VITAMIN_5; GAMBAR = Variables.GAMBAR_VITAMIN_5; break; case 6: ID = Variables.ID_VITAMIN_6; NAMA = Variables.NAMA_VITAMIN_6; KETERANGAN = Variables.KETERANGAN_VITAMIN_6; GAMBAR = Variables.GAMBAR_VITAMIN_6; break; case 7: ID = Variables.ID_VITAMIN_7; NAMA = Variables.NAMA_VITAMIN_7; KETERANGAN = Variables.KETERANGAN_VITAMIN_7; GAMBAR = Variables.GAMBAR_VITAMIN_7; break; case 8: ID = Variables.ID_VITAMIN_8; NAMA = Variables.NAMA_VITAMIN_8; KETERANGAN = Variables.KETERANGAN_VITAMIN_8;
case
case
case
case
case
GAMBAR = Variables.GAMBAR_VITAMIN_8; break; 9: ID = Variables.ID_VITAMIN_9; NAMA = Variables.NAMA_VITAMIN_9; KETERANGAN = Variables.KETERANGAN_VITAMIN_9; GAMBAR = Variables.GAMBAR_VITAMIN_9; break; 10: ID = Variables.ID_VITAMIN_10; NAMA = Variables.NAMA_VITAMIN_10; KETERANGAN = Variables.KETERANGAN_VITAMIN_10; GAMBAR = Variables.GAMBAR_VITAMIN_10; break; 11: ID = Variables.ID_VITAMIN_11; NAMA = Variables.NAMA_VITAMIN_11; KETERANGAN = Variables.KETERANGAN_VITAMIN_11; GAMBAR = Variables.GAMBAR_VITAMIN_11; break; 12: ID = Variables.ID_VITAMIN_12; NAMA = Variables.NAMA_VITAMIN_12; KETERANGAN = Variables.KETERANGAN_VITAMIN_12; GAMBAR = Variables.GAMBAR_VITAMIN_12; break; 13: ID = Variables.ID_VITAMIN_13; NAMA = Variables.NAMA_VITAMIN_13; KETERANGAN = Variables.KETERANGAN_VITAMIN_13; GAMBAR = Variables.GAMBAR_VITAMIN_13; break;
} final Vitamin lsVitamin = new Vitamin(); /******* Firstly take data in model object ******/ lsVitamin.setVitaminId(ID); lsVitamin.setVitaminNama(NAMA); lsVitamin.setVitaminKeterangan(KETERANGAN); lsVitamin.setImage(GAMBAR); /******** Take Model Object in ArrayList **********/ CustomListViewValuesArr.add(lsVitamin); } } @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 boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId();
if (id == R.id.kebutuhan_vitamin) { Intent iKebutuhanVitamin = new Intent(DaftarVitamin.this, KebutuhanVitamin.class); finish(); startActivity(iKebutuhanVitamin); return true; } else if (id == R.id.daftar_posyandu) { Intent iDaftarPosyandu = new Intent(DaftarVitamin.this, SplashPosyandu.class); finish(); startActivity(iDaftarPosyandu); return true; } else if (id == R.id.daftar_pemberian_vitamin) { Intent iDaftarPemberianVitamin = new Intent(DaftarVitamin.this, SplashPemberianVitamin.class); finish(); startActivity(iDaftarPemberianVitamin); return true; } else if (id == R.id.informasi) { Intent iPengembang = new Intent(DaftarVitamin.this, InfoActivity.class); finish(); startActivity(iPengembang); return true; } else if (id == R.id.keluar) { finish(); return true; } else { return super.onOptionsItemSelected(item); } } } 4. DetailPemberianVitamin.java package com.tugasakhir.src; import java.util.ArrayList; import com.tugasakhir.lib.Variables; import import import import import import import import import import import import
android.app.Activity; android.app.ProgressDialog; android.content.Intent; android.os.AsyncTask; android.os.Bundle; android.view.Menu; android.view.MenuItem; android.view.View; android.view.View.OnClickListener; android.widget.Button; android.widget.TextView; android.widget.Toast;
public class DetailPemberianVitamin extends Activity { // deklarasi form widget
private ProgressDialog pDialog; private TextView tPosyandu, tBalita, tUmur, tIbu, tAlamat, tKapsulBiru1, tKapsulMerah1, tKapsulMerah2, tKapsulMerah3, tKapsulMerah4; private Button bBack; // deklarasi variabel private String id_pemberian_vitamin; // deklarasi variabel array JSON private String POSYANDU; private String BALITA; private String UMUR; private String IBU; private String ALAMAT; private private private private private
String String String String String
KAPSULBIRU1; KAPSULMERAH1; KAPSULMERAH2; KAPSULMERAH3; KAPSULMERAH4;
// Array Adapter Quantity ArrayList<String> quantity = new ArrayList<String>(); public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.detail_pemberian_vitamin); // get id menu Intent iDetail = getIntent(); id_pemberian_vitamin = iDetail.getStringExtra("id_pemberian_vitamin"); // inisialisasi widget tPosyandu = (TextView) findViewById(R.id.txt_posyandu); tBalita = (TextView) findViewById(R.id.txt_nama); tUmur = (TextView) findViewById(R.id.txt_umur); tIbu = (TextView) findViewById(R.id.txt_ibu); tAlamat = (TextView) findViewById(R.id.txt_alamat); tKapsulBiru1 = (TextView) findViewById(R.id.txt_kapsulbiru1); tKapsulMerah1 = (TextView) findViewById(R.id.txt_kapsulmerah1); tKapsulMerah2 = (TextView) findViewById(R.id.txt_kapsulmerah2); tKapsulMerah3 = (TextView) findViewById(R.id.txt_kapsulmerah3); tKapsulMerah4 = (TextView) findViewById(R.id.txt_kapsulmerah4); // Get List Category GetDetailVitamin getDetailVitamin = new GetDetailVitamin(); getDetailVitamin.execute(); bBack = (Button) findViewById(R.id.btn_kembali); bBack.setOnClickListener(new OnClickListener() {
@Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(DetailPemberianVitamin.this, DaftarPemberianVitamin.class); startActivity(intent); finish(); } }); } private class GetDetailVitamin extends AsyncTask { @Override protected void onPreExecute() { // pDialog.setTitle("Loading"); pDialog = new ProgressDialog(DetailPemberianVitamin.this); pDialog.setMessage("Loading..."); pDialog.setIndeterminate(false); pDialog.setCancelable(true); pDialog.show(); } @Override protected String doInBackground(Void... String) { // TODO Auto-generated method stub for (int i = 0; i < 1000; i++) { } String result = "1"; return result; } @Override protected void onPostExecute(String result) { pDialog.dismiss(); if (result != null) { for (int i = 1; i < 6; i++) { int idxpemberianvitamin = Integer .parseInt(id_pemberian_vitamin); switch (idxpemberianvitamin) { case 1: POSYANDU = Variables.PEMBERIAN_VITAMIN_POSYANDU_1; BALITA = Variables.PEMBERIAN_VITAMIN_BALITA_1; UMUR = Variables.PEMBERIAN_VITAMIN_UMUR_1; IBU = Variables.PEMBERIAN_VITAMIN_IBU_1; ALAMAT = Variables.PEMBERIAN_VITAMIN_ALAMAT_1;
KAPSULBIRU1 = Variables.PEMBERIAN_VITAMIN_1_KAPSULBIRU_1; KAPSULMERAH1 = Variables.PEMBERIAN_VITAMIN_1_KAPSULMERAH_1; KAPSULMERAH2 = Variables.PEMBERIAN_VITAMIN_1_KAPSULMERAH_2; KAPSULMERAH3 = Variables.PEMBERIAN_VITAMIN_1_KAPSULMERAH_3; KAPSULMERAH4 = Variables.PEMBERIAN_VITAMIN_1_KAPSULMERAH_4; break; case 2: POSYANDU = Variables.PEMBERIAN_VITAMIN_POSYANDU_2; BALITA = Variables.PEMBERIAN_VITAMIN_BALITA_2; UMUR = Variables.PEMBERIAN_VITAMIN_UMUR_2; IBU = Variables.PEMBERIAN_VITAMIN_IBU_2; ALAMAT = Variables.PEMBERIAN_VITAMIN_ALAMAT_2; KAPSULBIRU1 = Variables.PEMBERIAN_VITAMIN_2_KAPSULBIRU_1; KAPSULMERAH1 = Variables.PEMBERIAN_VITAMIN_2_KAPSULMERAH_1; KAPSULMERAH2 = Variables.PEMBERIAN_VITAMIN_2_KAPSULMERAH_2; KAPSULMERAH3 = Variables.PEMBERIAN_VITAMIN_2_KAPSULMERAH_3; KAPSULMERAH4 = Variables.PEMBERIAN_VITAMIN_2_KAPSULMERAH_4; break; case 3: POSYANDU = Variables.PEMBERIAN_VITAMIN_POSYANDU_3; BALITA = Variables.PEMBERIAN_VITAMIN_BALITA_3; UMUR = Variables.PEMBERIAN_VITAMIN_UMUR_3; IBU = Variables.PEMBERIAN_VITAMIN_IBU_3; ALAMAT = Variables.PEMBERIAN_VITAMIN_ALAMAT_3; KAPSULBIRU1 = Variables.PEMBERIAN_VITAMIN_3_KAPSULBIRU_1; KAPSULMERAH1 = Variables.PEMBERIAN_VITAMIN_3_KAPSULMERAH_1; KAPSULMERAH2 = Variables.PEMBERIAN_VITAMIN_3_KAPSULMERAH_2; KAPSULMERAH3 = Variables.PEMBERIAN_VITAMIN_3_KAPSULMERAH_3; KAPSULMERAH4 = Variables.PEMBERIAN_VITAMIN_3_KAPSULMERAH_4; break; case 4:
POSYANDU = Variables.PEMBERIAN_VITAMIN_POSYANDU_4; BALITA = Variables.PEMBERIAN_VITAMIN_BALITA_4; UMUR = Variables.PEMBERIAN_VITAMIN_UMUR_4; IBU = Variables.PEMBERIAN_VITAMIN_IBU_4; ALAMAT = Variables.PEMBERIAN_VITAMIN_ALAMAT_4; KAPSULBIRU1 = Variables.PEMBERIAN_VITAMIN_4_KAPSULBIRU_1; KAPSULMERAH1 = Variables.PEMBERIAN_VITAMIN_4_KAPSULMERAH_1; KAPSULMERAH2 = Variables.PEMBERIAN_VITAMIN_4_KAPSULMERAH_2; KAPSULMERAH3 = Variables.PEMBERIAN_VITAMIN_4_KAPSULMERAH_3; KAPSULMERAH4 = Variables.PEMBERIAN_VITAMIN_4_KAPSULMERAH_4; break; case 5: POSYANDU = Variables.PEMBERIAN_VITAMIN_POSYANDU_5; BALITA = Variables.PEMBERIAN_VITAMIN_BALITA_5; UMUR = Variables.PEMBERIAN_VITAMIN_UMUR_5; IBU = Variables.PEMBERIAN_VITAMIN_IBU_5; ALAMAT = Variables.PEMBERIAN_VITAMIN_ALAMAT_5; KAPSULBIRU1 = Variables.PEMBERIAN_VITAMIN_5_KAPSULBIRU_1; KAPSULMERAH1 = Variables.PEMBERIAN_VITAMIN_5_KAPSULMERAH_1; KAPSULMERAH2 = Variables.PEMBERIAN_VITAMIN_5_KAPSULMERAH_2; KAPSULMERAH3 = Variables.PEMBERIAN_VITAMIN_5_KAPSULMERAH_3; KAPSULMERAH4 = Variables.PEMBERIAN_VITAMIN_5_KAPSULMERAH_4; break; } // set for widget tPosyandu.setText(": " + POSYANDU); tBalita.setText(": " + BALITA); tUmur.setText(": " + UMUR); tIbu.setText(": " + IBU); tAlamat.setText(": " + ALAMAT); tKapsulBiru1.setText(": " + KAPSULBIRU1); tKapsulMerah1.setText(": " + KAPSULMERAH1); tKapsulMerah2.setText(": " + KAPSULMERAH2);
tKapsulMerah3.setText(": " + KAPSULMERAH3); tKapsulMerah4.setText(": " + KAPSULMERAH4); } } else { Toast.makeText(getBaseContext(), "Error in retrieving data", Toast.LENGTH_SHORT).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.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.kebutuhan_vitamin) { Intent iKebutuhanVitamin = new Intent(DetailPemberianVitamin.this, KebutuhanVitamin.class); finish(); startActivity(iKebutuhanVitamin); return true; } else if (id == R.id.daftar_vitamin) { Intent iDaftarvitamin = new Intent(DetailPemberianVitamin.this, SplashPosyandu.class); finish(); startActivity(iDaftarvitamin); return true; } else if (id == R.id.daftar_vitamin) { Intent iDaftarVitamin = new Intent(DetailPemberianVitamin.this, SplashVitamin.class); finish(); startActivity(iDaftarVitamin); return true; } else if (id == R.id.informasi) { Intent iPengembang = new Intent(DetailPemberianVitamin.this, InfoActivity.class); finish(); startActivity(iPengembang); return true; } else if (id == R.id.keluar) { finish(); return true; } else { return super.onOptionsItemSelected(item);
} } } 5. DetailPosyandu.java package com.tugasakhir.src; import java.util.ArrayList; import com.tugasakhir.lib.Variables; import import import import import import import import import import import import import
android.app.Activity; android.app.ProgressDialog; android.content.Intent; android.os.AsyncTask; android.os.Bundle; android.view.Menu; android.view.MenuItem; android.view.View; android.view.View.OnClickListener; android.widget.Button; android.widget.ImageView; android.widget.TextView; android.widget.Toast;
public class DetailPosyandu extends Activity { // deklarasi form widget private ProgressDialog pDialog; private TextView tNama, tKetua, tBalita, tDesa, tAlamat; private ImageView iGambar; private Button bBack; // deklarasi variabel private String id_posyandu; // deklarasi variabel array JSON private String NAMA; private String KETUA; private String BALITA; private String DESA; private String ALAMAT; // Array Adapter Quantity ArrayList<String> quantity = new ArrayList<String>(); public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.detail_posyandu); // get id menu Intent iDetailMenu = getIntent(); id_posyandu = iDetailMenu.getStringExtra("id_posyandu"); // inisialisasi widget tNama = (TextView) findViewById(R.id.txt_nama); tKetua = (TextView) findViewById(R.id.txt_ketua); tBalita = (TextView) findViewById(R.id.txt_balita); tDesa = (TextView) findViewById(R.id.txt_desa);
tAlamat = (TextView) findViewById(R.id.txt_alamat); iGambar = (ImageView) findViewById(R.id.img_detail_gambar); // Get List Category GetDetailPosyandu getDetailPosyandu = new GetDetailPosyandu(); getDetailPosyandu.execute(); bBack = (Button) findViewById(R.id.btn_back); bBack.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(DetailPosyandu.this, DaftarPosyandu.class); startActivity(intent); finish(); } }); } private class GetDetailPosyandu extends AsyncTask { @Override protected void onPreExecute() { // pDialog.setTitle("Loading"); pDialog = new ProgressDialog(DetailPosyandu.this); pDialog.setMessage("Loading..."); pDialog.setIndeterminate(false); pDialog.setCancelable(true); pDialog.show(); } @Override protected String doInBackground(Void... String) { // TODO Auto-generated method stub for (int i = 0; i < 1000; i++) { } String result = "1"; return result; } @Override protected void onPostExecute(String result) { pDialog.dismiss(); if (result != null) { for (int i = 1; i < 6; i++) { int idxPosyandu = Integer.parseInt(id_posyandu); switch (idxPosyandu) { case 1: NAMA = Variables.NAMA_POSYANDU_1; KETUA = Variables.KETUA_POSYANDU_1;
DESA = Variables.DESA_POSYANDU_1; ALAMAT = Variables.ALAMAT_POSYANDU_1; BALITA = Variables.JUMLAH_BALITA_1; iGambar.setImageResource(R.drawable.posyandu1); break; case 2: NAMA = Variables.NAMA_POSYANDU_2; KETUA = Variables.KETUA_POSYANDU_2; DESA = Variables.DESA_POSYANDU_2; ALAMAT = Variables.ALAMAT_POSYANDU_2; BALITA = Variables.JUMLAH_BALITA_2; iGambar.setImageResource(R.drawable.posyandu2); break; case 3: NAMA = Variables.NAMA_POSYANDU_3; KETUA = Variables.KETUA_POSYANDU_3; DESA = Variables.DESA_POSYANDU_3; ALAMAT = Variables.ALAMAT_POSYANDU_3; BALITA = Variables.JUMLAH_BALITA_3; iGambar.setImageResource(R.drawable.posyandu3); break; case 4: NAMA = Variables.NAMA_POSYANDU_4; KETUA = Variables.KETUA_POSYANDU_4; DESA = Variables.DESA_POSYANDU_4; ALAMAT = Variables.ALAMAT_POSYANDU_4; BALITA = Variables.JUMLAH_BALITA_4; iGambar.setImageResource(R.drawable.posyandu4); break; case 5: NAMA = Variables.NAMA_POSYANDU_5; KETUA = Variables.KETUA_POSYANDU_5; DESA = Variables.DESA_POSYANDU_5; ALAMAT = Variables.ALAMAT_POSYANDU_5; BALITA = Variables.JUMLAH_BALITA_5; iGambar.setImageResource(R.drawable.posyandu5); break; } // set for widget tNama.setText(": " + NAMA); tKetua.setText(": " + KETUA); tBalita.setText(": " + BALITA); tDesa.setText(": " + DESA); tAlamat.setText(": " + ALAMAT); } } else { Toast.makeText(getBaseContext(), "Error in retrieving data",
Toast.LENGTH_SHORT).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.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.kebutuhan_vitamin) { Intent iKebutuhanVitamin = new Intent(DetailPosyandu.this, KebutuhanVitamin.class); finish(); startActivity(iKebutuhanVitamin); return true; } else if (id == R.id.daftar_posyandu) { Intent iDaftarPosyandu = new Intent(DetailPosyandu.this, SplashPosyandu.class); finish(); startActivity(iDaftarPosyandu); return true; } else if (id == R.id.daftar_vitamin) { Intent iDaftarVitamin = new Intent(DetailPosyandu.this, SplashVitamin.class); finish(); startActivity(iDaftarVitamin); return true; } else if (id == R.id.daftar_pemberian_vitamin) { Intent iDaftarPemberianVitamin = new Intent(DetailPosyandu.this, SplashPemberianVitamin.class); finish(); startActivity(iDaftarPemberianVitamin); return true; } else if (id == R.id.informasi) { Intent iPengembang = new Intent(DetailPosyandu.this, InfoActivity.class); finish(); startActivity(iPengembang); return true; } else if (id == R.id.keluar) { finish(); return true; } else { return super.onOptionsItemSelected(item); } } }
6. DetailVitamin.java package com.tugasakhir.src; import java.util.ArrayList; import com.tugasakhir.lib.Variables; import import import import import import import import import import import import import
android.app.Activity; android.app.ProgressDialog; android.content.Intent; android.os.AsyncTask; android.os.Bundle; android.view.Menu; android.view.MenuItem; android.view.View; android.view.View.OnClickListener; android.widget.Button; android.widget.ImageView; android.widget.TextView; android.widget.Toast;
public class DetailVitamin extends Activity { // deklarasi form widget private ProgressDialog pDialog; private TextView tNama, tKeterangan; private ImageView iGambar; private Button bBack; // deklarasi variabel private String id_vitamin; // deklarasi variabel array JSON private String NAMA; private String KETERANGAN; // Array Adapter Quantity ArrayList<String> quantity = new ArrayList<String>(); public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.detail_vitamin); // get id menu Intent iDetailMenu = getIntent(); id_vitamin = iDetailMenu.getStringExtra("id_vitamin"); // inisialisasi widget tNama = (TextView) findViewById(R.id.txt_nama); tKeterangan = (TextView) findViewById(R.id.txt_keterangan); iGambar = (ImageView) findViewById(R.id.img_detail_gambar); // Get List Category GetDetailVitamin getDetailVitamin = new GetDetailVitamin(); getDetailVitamin.execute(); bBack = (Button) findViewById(R.id.btn_back); bBack.setOnClickListener(new OnClickListener() {
@Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(DetailVitamin.this, DaftarVitamin.class); startActivity(intent); finish(); } }); } private class GetDetailVitamin extends AsyncTask { @Override protected void onPreExecute() { // pDialog.setTitle("Loading"); pDialog = new ProgressDialog(DetailVitamin.this); pDialog.setMessage("Loading..."); pDialog.setIndeterminate(false); pDialog.setCancelable(true); pDialog.show(); } @Override protected String doInBackground(Void... String) { // TODO Auto-generated method stub for (int i = 0; i < 1000; i++) { } String result = "1"; return result; } @Override protected void onPostExecute(String result) { pDialog.dismiss(); if (result != null) { for (int i = 1; i < 14; i++) { int idxvitamin = Integer.parseInt(id_vitamin); switch (idxvitamin) { case 1: NAMA = Variables.NAMA_VITAMIN_5; KETERANGAN = Variables.KETERANGAN_VITAMIN_5; iGambar.setImageResource(R.drawable.vitamin_a); break; case 2: NAMA = Variables.NAMA_VITAMIN_5; KETERANGAN = Variables.KETERANGAN_VITAMIN_5; iGambar.setImageResource(R.drawable.vitamin_b1); break;
case 3: NAMA = Variables.NAMA_VITAMIN_5; KETERANGAN = Variables.KETERANGAN_VITAMIN_5; iGambar.setImageResource(R.drawable.vitamin_b2); break; case 4: NAMA = Variables.NAMA_VITAMIN_5; KETERANGAN = Variables.KETERANGAN_VITAMIN_5; iGambar.setImageResource(R.drawable.vitamin_b3); break; case 5: NAMA = Variables.NAMA_VITAMIN_5; KETERANGAN = Variables.KETERANGAN_VITAMIN_5; iGambar.setImageResource(R.drawable.vitamin_b5); break; case 6: NAMA = Variables.NAMA_VITAMIN_6; KETERANGAN = Variables.KETERANGAN_VITAMIN_6; iGambar.setImageResource(R.drawable.vitamin_b6); break; case 7: NAMA = Variables.NAMA_VITAMIN_7; KETERANGAN = Variables.KETERANGAN_VITAMIN_7; iGambar.setImageResource(R.drawable.vitamin_b7); break; case 8: NAMA = Variables.NAMA_VITAMIN_8; KETERANGAN = Variables.KETERANGAN_VITAMIN_8; iGambar.setImageResource(R.drawable.vitamin_b9); break; case 9: NAMA = Variables.NAMA_VITAMIN_9; KETERANGAN = Variables.KETERANGAN_VITAMIN_9; iGambar.setImageResource(R.drawable.vitamin_b12); break; case 10: NAMA = Variables.NAMA_VITAMIN_10; KETERANGAN = Variables.KETERANGAN_VITAMIN_10; iGambar.setImageResource(R.drawable.vitamin_c); break; case 11: NAMA = Variables.NAMA_VITAMIN_11;
KETERANGAN = Variables.KETERANGAN_VITAMIN_11; iGambar.setImageResource(R.drawable.vitamin_d); break; case 12: NAMA = Variables.NAMA_VITAMIN_11; KETERANGAN = Variables.KETERANGAN_VITAMIN_11; iGambar.setImageResource(R.drawable.vitamin_e); break; case 13: NAMA = Variables.NAMA_VITAMIN_13; KETERANGAN = Variables.KETERANGAN_VITAMIN_13; iGambar.setImageResource(R.drawable.vitamin_k); break; } // set for widget tNama.setText(": " + NAMA); tKeterangan.setText(": " + KETERANGAN); } } else { Toast.makeText(getBaseContext(), "Error in retrieving data", Toast.LENGTH_SHORT).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.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.kebutuhan_vitamin) { Intent iKebutuhanVitamin = new Intent(DetailVitamin.this, KebutuhanVitamin.class); finish(); startActivity(iKebutuhanVitamin); return true; } else if (id == R.id.daftar_posyandu) { Intent iDaftarvitamin = new Intent(DetailVitamin.this, SplashPosyandu.class); finish(); startActivity(iDaftarvitamin); return true;
} else if (id == R.id.daftar_vitamin) { Intent iDaftarVitamin = new Intent(DetailVitamin.this, SplashVitamin.class); finish(); startActivity(iDaftarVitamin); return true; } else if (id == R.id.daftar_pemberian_vitamin) { Intent iDaftarPemberianVitamin = new Intent(DetailVitamin.this, SplashPemberianVitamin.class); finish(); startActivity(iDaftarPemberianVitamin); return true; } else if (id == R.id.informasi) { Intent iPengembang = new Intent(DetailVitamin.this, InfoActivity.class); finish(); startActivity(iPengembang); return true; } else if (id == R.id.keluar) { finish(); return true; } else { return super.onOptionsItemSelected(item); } } } 7. InfoActivity.java package com.tugasakhir.src; import import import import import import import import
android.app.Activity; android.content.Intent; android.os.Bundle; android.view.Menu; android.view.MenuItem; android.view.View; android.view.View.OnClickListener; android.widget.Button;
public class InfoActivity extends Activity { private Button btnQuit; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_info); btnQuit = (Button) findViewById(R.id.btn_quit); btnQuit.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(InfoActivity.this, MenuActivity.class); startActivity(intent); finish();
} }); } @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 boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.kebutuhan_vitamin) { Intent iKebutuhanVitamin = new Intent(InfoActivity.this, KebutuhanVitamin.class); finish(); startActivity(iKebutuhanVitamin); return true; } else if (id == R.id.daftar_posyandu) { Intent iDaftarPosyandu = new Intent(InfoActivity.this, SplashPosyandu.class); finish(); startActivity(iDaftarPosyandu); return true; } else if (id == R.id.daftar_vitamin) { Intent iDaftarVitamin = new Intent(InfoActivity.this, SplashVitamin.class); finish(); startActivity(iDaftarVitamin); return true; } else if (id == R.id.daftar_pemberian_vitamin) { Intent iDaftarPemberianVitamin = new Intent(InfoActivity.this, SplashPemberianVitamin.class); finish(); startActivity(iDaftarPemberianVitamin); return true; } else if (id == R.id.keluar) { finish(); return true; } else { return super.onOptionsItemSelected(item); } } } 8. KebutuhanVitamin.java package com.tugasakhir.src; import java.util.ArrayList;
import com.tugasakhir.adapter.KeteranganVitaminAdapter; import com.tugasakhir.lib.Variables; import import import import import import import import import import import import import import import import import import import import
android.annotation.SuppressLint; android.app.Activity; android.app.AlertDialog; android.content.DialogInterface; android.content.Intent; android.os.Bundle; android.text.Editable; android.text.TextWatcher; android.view.KeyEvent; android.view.Menu; android.view.MenuItem; android.view.View; android.view.View.OnClickListener; android.widget.AdapterView; android.widget.Button; android.widget.EditText; android.widget.ListView; android.widget.TextView; android.widget.AdapterView.OnItemClickListener; android.widget.TextView.OnEditorActionListener;
@SuppressLint("DefaultLocale") public class KebutuhanVitamin extends Activity implements OnClickListener, OnEditorActionListener, OnItemClickListener { ListView mListView; KeteranganVitaminAdapter mAdapter; Button btnSearch, btnLeft, bKembali; EditText mtxt; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.kebutuhan_vitamin); mListView = (ListView) findViewById(R.id.mListView); mAdapter = new KeteranganVitaminAdapter(this); btnSearch = (Button) findViewById(R.id.btnSearch); btnLeft = (Button) findViewById(R.id.btnLeft); mtxt = (EditText) findViewById(R.id.edSearch); mtxt.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override
public void afterTextChanged(Editable s) { if (0 != mtxt.getText().length()) { String spnId = mtxt.getText().toString(); setSearchResult(spnId); } else { setData(); } } }); btnLeft.setOnClickListener(this); btnSearch.setOnClickListener(this); setData(); bKembali = (Button) findViewById(R.id.btn_kembali); bKembali.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(KebutuhanVitamin.this, MenuActivity.class); startActivity(intent); finish(); } }); } ArrayList<String> mAllData; String[] str = { Variables.NAMA_VITAMIN_1, Variables.NAMA_VITAMIN_2, Variables.NAMA_VITAMIN_3, Variables.NAMA_VITAMIN_4, Variables.NAMA_VITAMIN_5, Variables.NAMA_VITAMIN_6, Variables.NAMA_VITAMIN_7, Variables.NAMA_VITAMIN_8, Variables.NAMA_VITAMIN_9, Variables.NAMA_VITAMIN_10, Variables.NAMA_VITAMIN_11, Variables.NAMA_VITAMIN_12, Variables.NAMA_VITAMIN_13 }; public void setData() { mAllData = new ArrayList<String>(); mAdapter = new KeteranganVitaminAdapter(this); for (int i = 0; i < str.length; i++) { mAdapter.addItem(str[i]); mAllData.add(str[i]); } mListView.setOnItemClickListener(this); mListView.setAdapter(mAdapter); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.btnSearch: mtxt.setText(""); setData(); break; case R.id.btnLeft:
break; } } @SuppressLint("DefaultLocale") public void setSearchResult(String str) { mAdapter = new KeteranganVitaminAdapter(this); for (String temp : mAllData) { if (temp.toLowerCase().contains(str.toLowerCase())) { mAdapter.addItem(temp); } } mListView.setAdapter(mAdapter); } @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { return false; } @Override public void onBackPressed() { setResult(Activity.RESULT_CANCELED); finish(); } @Override public void onItemClick(AdapterView> arg0, View arg1, int position, long arg3) { String str = mAdapter.getItem(position); String msg = defineKebutuhanVitamin(position); new AlertDialog.Builder(this) .setTitle(str) .setMessage(msg) .setNeutralButton("Close", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dlg, int sumthin) { // do whatever you want to do } }).show(); } private String defineKebutuhanVitamin(int posisi) { // TODO Auto-generated method stub String kebutuhan = null; posisi = posisi + 1; switch (posisi) { case 1: kebutuhan = Variables.KEBUTUHAN_VITAMIN_1;
break; case 2: kebutuhan break; case 3: kebutuhan break; case 4: kebutuhan break; case 5: kebutuhan break; case 6: kebutuhan break; case 7: kebutuhan break; case 8: kebutuhan break; case 9: kebutuhan break; case 10: kebutuhan break; case 11: kebutuhan break; case 12: kebutuhan break; case 13: kebutuhan break; }
= Variables.KEBUTUHAN_VITAMIN_2;
= Variables.KEBUTUHAN_VITAMIN_3;
= Variables.KEBUTUHAN_VITAMIN_4;
= Variables.KEBUTUHAN_VITAMIN_5;
= Variables.KEBUTUHAN_VITAMIN_6;
= Variables.KEBUTUHAN_VITAMIN_7;
= Variables.KEBUTUHAN_VITAMIN_8;
= Variables.KEBUTUHAN_VITAMIN_9;
= Variables.KEBUTUHAN_VITAMIN_10;
= Variables.KEBUTUHAN_VITAMIN_11;
= Variables.KEBUTUHAN_VITAMIN_12;
= Variables.KEBUTUHAN_VITAMIN_13;
return kebutuhan; } @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 boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.daftar_posyandu) { Intent iDaftarPosyandu = new Intent(KebutuhanVitamin.this, SplashPosyandu.class);
finish(); startActivity(iDaftarPosyandu); return true; } else if (id == R.id.daftar_vitamin) { Intent iDaftarVitamin = new Intent(KebutuhanVitamin.this, SplashVitamin.class); finish(); startActivity(iDaftarVitamin); return true; } else if (id == R.id.daftar_pemberian_vitamin) { Intent iDaftarPemberianVitamin = new Intent(KebutuhanVitamin.this, SplashPemberianVitamin.class); finish(); startActivity(iDaftarPemberianVitamin); return true; } else if (id == R.id.informasi) { Intent iPengembang = new Intent(KebutuhanVitamin.this, InfoActivity.class); finish(); startActivity(iPengembang); return true; } else if (id == R.id.keluar) { finish(); return true; } else { return super.onOptionsItemSelected(item); } } } 9. MainActivity.java package com.tugasakhir.src; import com.tugasakhir.lib.DataLoaderFragment; import com.tugasakhir.lib.DataLoaderFragment.ProgressListener; import com.tugasakhir.lib.SplashScreenFragment; import import import import
android.app.Activity; android.app.FragmentManager; android.content.Intent; android.os.Bundle;
public class MainActivity extends Activity implements ProgressListener { private static final String TAG_DATA_LOADER = "dataLoader"; private static final String TAG_SPLASH_SCREEN = "splashScreen"; private DataLoaderFragment mDataLoaderFragment; private SplashScreenFragment mSplashScreenFragment; @Override public void onCompletion(Double result) { // For the sake of brevity, we just show a TextView with the result mDataLoaderFragment = null; setContentView(R.layout.splash_screen);
// METHOD 1 /****** Create Thread that will sleep for 5 seconds *************/ Thread background = new Thread() { public void run() { try { // Thread will sleep for 5 seconds sleep(2 * 1000); // After 5 seconds redirect to another intent Intent i = new Intent(getBaseContext(), MenuActivity.class); startActivity(i); // Remove activity finish(); } catch (Exception e) { } } }; // start thread background.start(); } @Override public void onProgressUpdate(int progress) { mSplashScreenFragment.setProgress(progress); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final FragmentManager fm = getFragmentManager(); mDataLoaderFragment = (DataLoaderFragment) fm .findFragmentByTag(TAG_DATA_LOADER); if (mDataLoaderFragment == null) { mDataLoaderFragment = new DataLoaderFragment(); mDataLoaderFragment.setProgressListener(this); mDataLoaderFragment.startLoading(); fm.beginTransaction().add(mDataLoaderFragment, TAG_DATA_LOADER) .commit(); } else { if (checkCompletionStatus()) { return; } } // Show loading fragment mSplashScreenFragment = (SplashScreenFragment) fm .findFragmentByTag(TAG_SPLASH_SCREEN);
if (mSplashScreenFragment == null) { mSplashScreenFragment = new SplashScreenFragment(); fm.beginTransaction() .add(android.R.id.content, mSplashScreenFragment, TAG_SPLASH_SCREEN).commit(); } } @Override protected void onStart() { super.onStart(); if (mDataLoaderFragment != null) { checkCompletionStatus(); } } @Override protected void onStop() { super.onStop(); if (mDataLoaderFragment != null) { mDataLoaderFragment.removeProgressListener(); } } /** * Checks if data is done loading, if it is, the result is handled * * @return true if data is done loading */ private boolean checkCompletionStatus() { if (mDataLoaderFragment.hasResult()) { onCompletion(mDataLoaderFragment.getResult()); FragmentManager fm = getFragmentManager(); mSplashScreenFragment = (SplashScreenFragment) fm .findFragmentByTag(TAG_SPLASH_SCREEN); if (mSplashScreenFragment != null) { fm.beginTransaction().remove(mSplashScreenFragment).commit(); } return true; } mDataLoaderFragment.setProgressListener(this); return false; } } 10. MenuActivity.java package com.tugasakhir.src; import import import import import import import import
android.app.Activity; android.content.Intent; android.os.Bundle; android.view.Menu; android.view.MenuItem; android.view.View; android.view.View.OnClickListener; android.widget.Button;
public class MenuActivity extends Activity { // deklarasi widget private Button bKebutuhanVitamin, bDaftarPosyandu, bDaftarVitamin, bPemberianVitamin, bKeluar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); bKebutuhanVitamin = (Button) findViewById(R.id.btn_kebutuhan_vitamin); bKebutuhanVitamin.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Intent iKebutuhanVitamin = new Intent(MenuActivity.this, KebutuhanVitamin.class); startActivity(iKebutuhanVitamin); finish(); } }); bDaftarPosyandu = (Button) findViewById(R.id.btn_daftar_posyandu); bDaftarPosyandu.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Intent iDaftarPosyandu = new Intent(MenuActivity.this, SplashPosyandu.class); startActivity(iDaftarPosyandu); finish(); } }); bDaftarVitamin = (Button) findViewById(R.id.btn_daftar_vitamin); bDaftarVitamin.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Intent iDaftarVitamin = new Intent(MenuActivity.this, SplashVitamin.class); startActivity(iDaftarVitamin); finish(); } });
bPemberianVitamin = (Button) findViewById(R.id.btn_pemberian_vitamin); bPemberianVitamin.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Intent iPemberianVitamin = new Intent(MenuActivity.this, DaftarPemberianVitamin.class); startActivity(iPemberianVitamin); finish(); } }); bKeluar = (Button) findViewById(R.id.btn_keluar); bKeluar.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub finish(); } }); } @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 boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.kebutuhan_vitamin) { Intent iKebutuhanVitamin = new Intent(MenuActivity.this, KebutuhanVitamin.class); finish(); startActivity(iKebutuhanVitamin); return true; } else if (id == R.id.daftar_posyandu) { Intent iDaftarPosyandu = new Intent(MenuActivity.this, SplashPosyandu.class); finish(); startActivity(iDaftarPosyandu); return true; } else if (id == R.id.daftar_vitamin) { Intent iDaftarVitamin = new Intent(MenuActivity.this,
}
}
}
}
SplashVitamin.class); finish(); startActivity(iDaftarVitamin); return true; else if (id == R.id.daftar_pemberian_vitamin) { Intent iDaftarVitamin = new Intent(MenuActivity.this, SplashPemberianVitamin.class); finish(); startActivity(iDaftarVitamin); return true; else if (id == R.id.informasi) { Intent iPengembang = new Intent(MenuActivity.this, InfoActivity.class); finish(); startActivity(iPengembang); return true; else if (id == R.id.keluar) { finish(); return true; else { return super.onOptionsItemSelected(item);
} } } 11. SplashPemberianVitamin.java package com.tugasakhir.src; import import import import import
android.app.Activity; android.content.Intent; android.os.Bundle; android.os.Handler; android.view.View;
public class SplashPemberianVitamin extends Activity { // Introduce an delay private final int WAIT_TIME = 2500; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); System.out.println("LoadingScreenActivity screen started"); setContentView(R.layout.activity_splash); findViewById(R.id.pgr_loading).setVisibility(View.VISIBLE); new Handler().postDelayed(new Runnable() { @Override public void run() { // Simulating a long running task try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("Loading...");
/* Create an Intent that will start the ProfileData-Activity. */ Intent iPemberianVitamin = new Intent( SplashPemberianVitamin.this, DaftarPemberianVitamin.class); SplashPemberianVitamin.this.startActivity(iPemberianVitamin); SplashPemberianVitamin.this.finish(); } }, WAIT_TIME); } } 12. SplashPosyandu.java package com.tugasakhir.src; import import import import import
android.app.Activity; android.content.Intent; android.os.Bundle; android.os.Handler; android.view.View;
public class SplashPosyandu extends Activity { // Introduce an delay private final int WAIT_TIME = 2500; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); System.out.println("LoadingScreenActivity screen started"); setContentView(R.layout.activity_splash); findViewById(R.id.pgr_loading).setVisibility(View.VISIBLE); new Handler().postDelayed(new Runnable() { @Override public void run() { // Simulating a long running task try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("Loading..."); /* Create an Intent that will start the ProfileData-Activity. */ Intent iPosyandu = new Intent(SplashPosyandu.this, DaftarPosyandu.class); SplashPosyandu.this.startActivity(iPosyandu); SplashPosyandu.this.finish(); } }, WAIT_TIME); } }
13. SplashVitamin.java package com.tugasakhir.src; import import import import import
android.app.Activity; android.content.Intent; android.os.Bundle; android.os.Handler; android.view.View;
public class SplashVitamin extends Activity { // Introduce an delay private final int WAIT_TIME = 2500; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); System.out.println("LoadingScreenActivity screen started"); setContentView(R.layout.activity_splash); findViewById(R.id.pgr_loading).setVisibility(View.VISIBLE); new Handler().postDelayed(new Runnable() { @Override public void run() { // Simulating a long running task try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("Loading..."); /* Create an Intent that will start the ProfileData-Activity. */ Intent iVitamin = new Intent(SplashVitamin.this, DaftarVitamin.class); SplashVitamin.this.startActivity(iVitamin); SplashVitamin.this.finish(); } }, WAIT_TIME); } }
Layout 1. activity_info.xml
android:layout_marginTop="1dip" android:layout_toRightOf="@+id/txtview_nim" android:text="@string/nim_nya" android:textColor="#040404" android:textSize="20sp" android:textStyle="bold" android:typeface="sans" /> <Button android:id="@+id/btn_quit" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:text="@string/kembali" /> 2. activity_main.xml
android:background="@drawable/image_bg" android:padding="3dip" > <Button android:id="@+id/btn_keluar" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:text="@string/keluar" /> <Button android:id="@+id/btn_daftar_vitamin" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_above="@+id/btn_keluar" android:layout_alignParentLeft="true" android:text="@string/daftar_vitamin" /> <Button android:id="@+id/btn_daftar_posyandu" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_above="@+id/btn_daftar_vitamin" android:layout_alignParentLeft="true" android:text="@string/daftar_posyandu" /> <Button android:id="@+id/btn_kebutuhan_vitamin" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_above="@+id/btn_daftar_posyandu" android:layout_alignParentLeft="true" android:text="@string/kebutuhan_vitamin_balita" /> <Button android:id="@+id/btn_pemberian_vitamin" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_above="@+id/btn_kebutuhan_vitamin" android:layout_alignParentLeft="true" android:text="@string/daftar_pemberian_vitamin" />
3. activity_splash.xml 4. daftar_pemberian_vitamin.xml <Button android:id="@+id/btn_kembali" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:text="@string/kembali" />
5. daftar_posyandu.xml <Button android:id="@+id/btn_kembali" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:text="@string/kembali" /> 6. daftar_vitamin.xml <Button android:id="@+id/btn_kembali" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:text="@string/kembali" />
7. detail_pemberian_vitamin.xml
android:layout_width="wrap_content" android:layout_height="30dp" android:layout_alignTop="@+id/txtview_nama" android:layout_marginTop="1dip" android:layout_toRightOf="@+id/txtview_nama" android:layout_below="@+id/txt_posyandu" android:text="@string/titik_dua" android:textColor="#040404" android:textSize="15sp" android:textStyle="bold" android:typeface="sans" />
android:textStyle="bold" android:typeface="sans" />
android:text="@string/kapsul_biru" android:textColor="#040404" android:textSize="12sp" android:typeface="sans" />
android:text="@string/titik_dua" android:textColor="#040404" android:typeface="sans" /> <Button android:id="@+id/btn_kembali" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:text="@string/kembali" />
8. detail_posyandu.xml
android:textColor="#040404" android:textSize="15sp" android:textStyle="bold" android:typeface="sans" /> <Button android:id="@+id/btn_back" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:text="@string/kembali" />
9. detail_vitamin.xml
<ScrollView android:id="@+id/ScrollView01" android:layout_width="fill_parent" android:layout_height="50dp" android:layout_alignParentBottom="true" android:layout_alignTop="@+id/txtview_keterangan" android:layout_below="@+id/txt_nama" android:layout_toRightOf="@+id/txtview_keterangan" > <Button android:id="@+id/btn_back" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:text="@string/kembali" />
10. fragment_main.xml
11. kebutuhan_vitamin.xml <Button android:id="@+id/btnSearch" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:layout_marginRight="2dp" android:background="@drawable/cancel_search" /> <Button android:id="@+id/btnLeft" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_centerVertical="true" android:layout_marginLeft="2dp" android:background="@drawable/icon_search" /> <EditText android:id="@+id/edSearch" android:layout_width="match_parent" android:layout_height="40dp" android:layout_centerVertical="true" android:layout_toLeftOf="@id/btnSearch" android:layout_toRightOf="@id/btnLeft" android:background="@null" android:hint="@string/some_hint" android:imeOptions="actionSearch" android:singleLine="true" />
android:layout_marginTop="5dp" android:cacheColorHint="@android:color/transparent" android:divider="@android:color/black" android:dividerHeight="2dp" > <Button android:id="@+id/btn_kembali" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:text="@string/kembali" /> 12. single_kebutuhan_vitamin.xml 13. single_pemberian_vitamin.xml
android:layout_marginTop="10dip" android:text="@string/nama_balita" android:textColor="#343434" android:textSize="13sp" />
14. single_posyandu.xml
android:layout_alignTop="@+id/list_thumbnail" android:layout_marginBottom="5dip" android:layout_toRightOf="@+id/list_thumbnail" android:text="@string/nama_posyandu" android:textColor="#040404" android:textSize="15sp" android:textStyle="bold" android:typeface="sans" /> 15. single_vitamin.xml
16. splash_screen.xml
Menu 1. main.xml <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" tools:context="tugas.simulasi.djikstra.MainActivity" >
Values 1. strings.xml <string name="app_name">Cari Posyandu Di Wilayah Cikupa <string name="hello_world">Hello world! <string name="action_settings">Settings <string name="loading">Loading … <string name="menu_utama">Menu Utama <string name="kebutuhan_vitamin_balita">Kebutuhan Vitamin Balita <string name="daftar_posyandu">Daftar Posyandu <string name="daftar_vitamin">Daftar Vitamin <string name="daftar_pemberian_vitamin">Daftar Pemberian Vitamin A <string name="detail_posyandu">Detail Posyandu <string name="detail_vitamin">Detail Vitamin <string name="detail_pemberian_vitamin">Detail Pemberian Vitamin <string name="informasi">Informasi <string name="keluar">Keluar <string name="kembali">Kembali <string name="arrow">Detail <string name="image">Image <string name="nama_posyandu">Nama Posyandu <string name="ketua_posyandu">Ketua Posyandu <string name="desa_posyandu">Desa Posyandu <string name="alamat_posyandu">Alamat Posyandu <string name="nama_vitamin">Nama Vitamin <string name="keterangan_vitamin">Nama Vitamin <string name="nama">Nama <string name="ketua">Ketua <string name="desa">Desa <string name="alamat">Alamat <string name="jumlah_balita">Jumlah Balita <string name="kelurahan">Kelurahan <string name="keterangan">Keterangan <string name="titik_dua">: <string name="strip">- <string name="nim">NIM <string name="judul_skripsi">Judul <string name="nama_nya">: Bahtiar <string name="nim_nya">: 41507010047 <string name="judul_nya">: Perancangan Aplikasi Informasi Posyandu Di Wilayah Kecamatan Cikupa Tanggerang Berbasis Android <string name="some_text">Kebutuhan Vitamin Untuk Balita <string name="some_hint">Type here to filter… <string name="nama_balita">Nama Balita <string name="umur_balita">Umur Balita <string name="nama_ibu">Nama Ibu <string name="posyandu">Posyandu <string name="catatan_pemberian_vitamin_a">Catatan Pemberian Vitamin A <string name="kapsul_biru">1 Kapsul biru dibulan februari atau agustus <string name="kapsul_merah">1 Kapsul merah dibulan februari dan agustus
Manifest <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.tugasakhir.src" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" />
Daftar Riwayat Hidup Bahtiar – 083893040695 – [email protected]
Data Pribadi NIM
41507010047
Nama
Bahtiar
Jenis Kelamin
Laki-Laki
Tempat, Tanggal Lahir
Tangerang, 07 April 1980
Agama
Islam
Kewarganegaraan
Indonesia
Status
Belum Menikah
Alamat
Jl.H.R.Rasunasaid Cipete Pinang RT 04/04 Tangerang
No. Telepon
083893040695
E-Mail
[email protected]
Pendidikan Formal 2007 – 2014
Universitas Mercu Buana, Teknik Informatika Tugas Akhir : Aplikasi Multimedia
2005 – 2007
SMK Voctech 1 Tangerang
2002 – 2005
SMP PGRI 2 Tangerang
1997 – 2002
SDN Cipete 4
Keterampilan Menguasai sistem operasi Windows. Mengenal dan mampu menggunakan Ms. Office Senang Berkreasi, ekspresif dan menyukai tantangan.