Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.
Agus Haryanto, MKOMhttp://agusharyanto.net@agus_inovatoragus.superwriter@gmail.com08551000444 / 089673371119 
Juara 2 Indo...
ANDROID PHP MYSQL 
Kali ini kita akan membahas Bagaimana Android dapat mengirim data ke server dan membacanya. Ada beberap...
2.Siapkan Script PHP untuk memasukkan data baru ke tbl_phone, simpan dengan nama add_phone.php simpan didirectory document...
5.Siakan Scritpt untuk menghapus data phone di server, simpan dengan nama delete_phone.php 
<?php 
$id = $_POST['id']; 
$l...
import java.io.InputStream; 
import java.io.InputStreamReader; 
import org.apache.http.HttpResponse; 
import org.apache.ht...
8.Buat class JSONFunction .java lalu ketikkan kode berikut 
package net.agusharyanto.mysqlphone; 
import java.io.BufferedR...
Log.e("log_tag", "Error converting result " + e.toString()); 
result = "{"errorcode":"0"}"; 
} 
try { 
jArray = new JSONOb...
result = "{"errorcode":"0"}"; 
} 
return result; 
} 
} 
Class JSONFunction ini digunakan untuk menangkap nilai kembalian d...
android:layout_height="wrap_content" android:layout_weight = "1" 
android:layout_alignParentLeft="true" 
android:layout_be...
import android.view.MenuItem; 
import android.view.View; 
import android.widget.AdapterView; 
import android.widget.ListAd...
getDataPhone(); 
} 
} 
} 
public void getDataPhone() { 
mylist.clear(); 
requestTask task = new requestTask(); 
task.appli...
listView1.setAdapter(adapter); 
registerForContextMenu(listView1); 
} 
@Override 
public void onCreateContextMenu(ContextM...
} 
private void addData(HashMap<String, String> o, String action) { 
callIntent(o, action); 
} 
private void callIntent(Ha...
super.onCreate(savedInstanceState); 
setContentView(R.layout.add); 
edtName = (EditText) findViewById(R.id.edtName); 
edtP...
private void setResult(String result){ 
Toast.makeText(getBaseContext(), result, Toast.LENGTH_LONG).show(); 
finish(); 
} ...
Tekan yang lama pada salah satu baris 
Akan muncul konteks menu, jika ingin menambah data sentuh ADD, untuk merubah data s...
TugasBuatlah Aplikasi User Management yang inputannya terdiri dari username, password, nama_lengkap.
Android Fast Track CRUD Android PHP MySql
Próxima SlideShare
Cargando en…5
×

Android Fast Track CRUD Android PHP MySql

27.371 visualizaciones

Publicado el

Create Read Update Delete data in MySQL Database From Android. Android call php address to access MySQL database.

Publicado en: Móvil

Android Fast Track CRUD Android PHP MySql

  1. 1. Agus Haryanto, MKOMhttp://agusharyanto.net@agus_inovatoragus.superwriter@gmail.com08551000444 / 089673371119 Juara 2 Indosat M2 Android Application ContestJuara Harapan Kompetisi Android T-Market (Telesindo) Juara 1 BBDEVID Challenge Blackberry Application (Webworks) Juara 1 AngelHack Blackberry Indonesia
  2. 2. ANDROID PHP MYSQL Kali ini kita akan membahas Bagaimana Android dapat mengirim data ke server dan membacanya. Ada beberapa pendekatan untuk komunikasi dengan server ini tetapi yang sering dipakai adalah melalui http. Dengan demikian untuk mempraktekannya kita harus menginstall apache web server lengakap dengan PHP dan MySQLnya. CRUD ANDROID PHP MYSQL Aplikasi yang menggunakan database pada umumnya memiliki fungsi untuk –Menampilkan data –Menambah data –Menghapus data –Merubah data Database SQLite pada android mempunyai keterbatasan pada salah satunya pada kapasitas penyimpanan data. Akan bermasalah apabila kita memaksakan menyimpan data yang besar (lebih dari 10000 data) pada SQLite. Selain itu jika kita ingin perubahan data aplikasi dirasakan oleh semua user tanpa harus install ulang aplikasi, maka data harus disimpan di Server. Cara yang paling sering digunakan adalah dengan perantara Webserver, PHP dan MySQL. Dimana android untuk melakukan perubahan data atau mendapatkan data dari database server cukup dengan memanggil url php yang telah ditentukan. Agar lebih dimengerti mari kita buat aplikasi tentang maintenance data harga handphone yang database servernya menggunakan MySQL dengan Web Server Apache dan Server Side Scriptnya menggunakan PHP untuk itu hal yang penting untuk dilakukan sebelum memulai pembuatan aplikasinya adalah menyiaplkan environment servernya dengan menginstall XAMPP (Windows) atau LAMP (Linux). Setelah selesai Instalasi lalu kita lakukan langkah berikut. 1.Pekerjaan di MySql, buat database dan tablenya. CREATE DATABASE db_phone; CREATE TABLE tbl_phone ( id INT(4) NOT NULL AUTO_INCREMENT, phone_name VARCHAR(32) NOT NULL, price INT(10) NOT NULL, PRIMARY KEY (id) ) ENGINE=MyISAM; insert into tbl_phone values(null,'Galaxy S3',6000000); insert into tbl_phone values(null,'Galaxy Ace 2',3000000); insert into tbl_phone values( null,'HTC One',6000000);
  3. 3. 2.Siapkan Script PHP untuk memasukkan data baru ke tbl_phone, simpan dengan nama add_phone.php simpan didirectory document_root/phone contoh htdoc/phone jadi urlnya adalah “http://yourdomain/phone/add_phone.php” <?php $phone_name = $_POST['phone_name']; $price = $_POST['price']; $link = mysql_connect('localhost', 'user', 'password') or die('Cannot connect to the DB'); mysql_select_db('db_phone', $link) or die('Cannot select the DB'); /* grab the posts from the db */ $query = "insert into tbl_phone (phone_name,price) values('".$phone_name."',".$price.")"; $result = mysql_query($query, $link) or die('Error query: '.$query); if ($result == 1){echo "Save Data Success";}else{ echo "Save Data Fail";} ?> 3.Siapkan Script untuk menampilkan data yang sudah disimpan, simpan dengan nama list_phone.php <?php $link = mysql_connect('localhost', 'user', 'password') or die('Cannot connect to the DB'); mysql_select_db('db_phone', $link) or die('Cannot select the DB'); $result["errorcode"]="0"; /* grab the posts from the db */ $query = "SELECT id, phone_name, price FROM tbl_phone"; $rs= mysql_query($query, $link) or die('Errorquery: '.$query); $countrow= mysql_affected_rows(); $items = array(); while($row = mysql_fetch_object($rs)){ array_push($items, $row); } if($countrow >0){ $result["errorcode"] = "1"; $result["data"] = $items; }else{ $result["errormsg"] = "Tidak ada data"; } echo json_encode($result); ?> 4.Siapkan Script untuk Melakkukan perubahan data phone diserver, simpan dengan nama edit_phone.php <?php $id = $_POST['id']; $phone_name = $_POST['phone_name']; $price = $_POST['price']; $link = mysql_connect('localhost', 'user', 'password') or die('Cannot connect to the DB'); mysql_select_db('db_phone', $link) or die('Cannot select the DB'); /* grab the posts from the db */ $query = "update tbl_phone set phone_name='$phone_name',price=$price where id=$id"; $result = mysql_query($query, $link) or die('Error query: '.$query); if ($result == 1){echo "Save Data Success";}else{ echo "Save Data Fail";} ?>
  4. 4. 5.Siakan Scritpt untuk menghapus data phone di server, simpan dengan nama delete_phone.php <?php $id = $_POST['id']; $link = mysql_connect('localhost', 'user', 'password') or die('Cannot connect to the DB'); mysql_select_db('db_phone', $link) or die('Cannot select the DB'); /* grab the posts from the db */ $query = "delete from tbl_phone where id=$id"; $result = mysql_query($query, $link) or die('Error query: '.$query); if ($result == 1){echo "Save Data Success";}else{ echo "Save Data Fail";} ?> 6.Sekarang mari kita siapkan bagian androidnya, buat new android project MySQLPhone 7.Buat Class HttpHelper.java lalu ketikkan kode berikut package net.agusharyanto.mysqlphone; import java.io.BufferedReader;
  5. 5. import java.io.InputStream; import java.io.InputStreamReader; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import android.util.Log; public class HttpHelper { /** * Method untuk Mengirimkan data kes erver event by button login diklik * * @param view */ public static String getRequest(String Url) { String sret=""; HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet(Url); try { HttpResponse response = client.execute(request); sret= request(response); } catch (Exception ex) { } return sret; } /** * Method untuk Menenrima data dari server * * @param response * @return */ public static String request(HttpResponse response) { String result = ""; try { InputStream in = response.getEntity().getContent(); BufferedReader reader = new BufferedReader( new InputStreamReader(in)); StringBuilder str = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { str.append(line + "n"); } in.close(); result = str.toString(); } catch (Exception ex) { result = "Error"; } return result; } } Class HttpHelper ini digunakan untuk mengirim data keserver dan menangkap nilai yang dikembalikan server.
  6. 6. 8.Buat class JSONFunction .java lalu ketikkan kode berikut package net.agusharyanto.mysqlphone; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.params.BasicHttpParams; import org.apache.http.params.HttpConnectionParams; import org.apache.http.params.HttpParams; import org.json.JSONException; import org.json.JSONObject; import android.util.Log; public class JSONfunctions { public static JSONObject getJSONfromURL(String url) { InputStream is = null; String result = "0"; JSONObject jArray = null; try { HttpParams httpParameters = new BasicHttpParams(); int timeoutConnection = 60000; HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection); int timeoutSocket = 60000; HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket); HttpClient httpclient = new DefaultHttpClient(httpParameters); HttpPost httppost = new HttpPost(url); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); is = entity.getContent(); } catch (Exception e) { Log.e("log_tag", "Error intimeout http connection " + e.toString()); } // convert response to string try { BufferedReader reader = new BufferedReader(new InputStreamReader( is, "iso-8859-1"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "n"); } is.close(); result = sb.toString(); } catch (Exception e) {
  7. 7. Log.e("log_tag", "Error converting result " + e.toString()); result = "{"errorcode":"0"}"; } try { jArray = new JSONObject(result); } catch (JSONException e) { Log.e("log_tag", "Error parsing data " + e.toString()); result = "{"errorcode":"0"}"; try { jArray = new JSONObject(result); } catch (JSONException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } return jArray; } public static String getStringJSONfromURL(String url) { InputStream is = null; String result = "0"; // http post try { HttpParams httpParameters = new BasicHttpParams(); int timeoutConnection = 60000; HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection); int timeoutSocket = 60000; HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket); HttpClient httpclient = new DefaultHttpClient(httpParameters); HttpPost httppost = new HttpPost(url); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); is = entity.getContent(); } catch (Exception e) { Log.e("log_tag", "Error intimeout http connection " + e.toString()); } // convert response to string try { BufferedReader reader = new BufferedReader(new InputStreamReader( is, "iso-8859-1"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "n"); } is.close(); result = sb.toString(); } catch (Exception e) { Log.e("log_tag", "Error converting result " + e.toString());
  8. 8. result = "{"errorcode":"0"}"; } return result; } } Class JSONFunction ini digunakan untuk menangkap nilai kembalian dari server yang datanya berupa JSON 9.Buat Layoutbaru dengan nama add.xml lalu ketikan kode berikut <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:text = "Smart Phone Name :" android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView> < EditText android:text = "" android:id = "@+id/edtName" android:layout_width="fill_parent" android:layout_height="wrap_content"></EditText> <TextView android:text = "Price :" android:id="@+id/TextView02" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView> < EditText android:text = "" android:id = "@+id/edtPrice" android:layout_width="fill_parent" android:layout_height="wrap_content"></EditText> <Button android:text = "Simpan" android:id="@+id/btnSave" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button> </LinearLayout> 10.Buat Layout dengan nama listphone.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/textView1" android:layout_width="150sp" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:text = "Phone Name" android:background="@drawable/border" android:textSize="20sp" android:padding="5sp" /> <TextView android:id="@+id/textView2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:background="@drawable/border" android:layout_toRightOf="@+id/textView1" android:text = "Price" android:textSize="20sp" android:padding="5sp" /> <ListView android:id="@+id/list1" android:layout_width="fill_parent"
  9. 9. android:layout_height="wrap_content" android:layout_weight = "1" android:layout_alignParentLeft="true" android:layout_below="@+id/textView1"/> </RelativeLayout> 11.Buat layout dengan nama row.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" android:paddingBottom="5sp" android:paddingTop="5sp" > < TextView android:id="@+id/phonename" android:layout_width="150sp" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:padding="5sp" /> < TextView android:id="@+id/price" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="right" android:layout_toRightOf="@+id/phonename" android:padding="5sp" /> <TextView android:id="@+id/idphone" android:layout_width="0sp" android:layout_height="wrap_content" android:layout_toRightOf = "@+id/indonesia" android:visibility="gone"/> </RelativeLayout> 12.Semua Layout sudah siap, saatnya membuat bagian javanya. Pada awal yang ditampilkan adalah list smartphone dan harganya, buat class baru dengan nama ListDataPhoneActivity.java package net.agusharyanto.mysqlphone; import java.util.ArrayList; import java.util.HashMap; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.ContextMenu; import android.view.Menu;
  10. 10. import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.SimpleAdapter; import android.widget.Toast; public class ListDataPhoneActivity extends Activity { /** Called when the activity is first created. */ private ListView listView1; private static final int REQUEST_CODE = 1; private ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>(); private static final int ADD_ID = Menu.FIRST + 1; private static final int EDIT_ID = Menu.FIRST + 2; private static final int DELETE_ID = Menu.FIRST + 3; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.listphone); try { getDataPhone(); } catch (Exception e) { Log.e("log_tag", "Error parsing data " + e.toString()); } } /** * Class CallWebPageTask untuk implementasi class AscyncTask */ private class requestTask extends AsyncTask<String, Void, String> { private ProgressDialog dialog; protected Context applicationContext; private String actionflag; @Override protected void onPreExecute() { this.dialog = ProgressDialog.show(applicationContext, "Load Data From Server Process", "Please Wait...", true); } @Override protected String doInBackground(String... urls) { String response = ""; response = getDataServer(urls[0]); return response; } @Override protected void onPostExecute(String result) { this.dialog.cancel(); if (actionflag.equals("list")) { if (result.equals("1")) setListData(); } else if (actionflag.equals("delete")) {
  11. 11. getDataPhone(); } } } public void getDataPhone() { mylist.clear(); requestTask task = new requestTask(); task.applicationContext = ListDataPhoneActivity.this; task.actionflag = "list"; String url = "http://10.0.2.2/phone/list_phone.php"; task.execute(new String[] { url }); } public String getDataServer(String url) { String sret = "1"; JSONObject json = JSONfunctions.getJSONfromURL(url); try { if (json.getString("errorcode").equals("0")) { Toast.makeText(getBaseContext(), json.getString("errormsg"), Toast.LENGTH_SHORT).show(); sret = "0"; } JSONArray makanan = json.getJSONArray("data"); for (int i = 0; i < makanan.length(); i++) { HashMap<String, String> map = new HashMap<String, String>(); JSONObject jsonobj = makanan.getJSONObject(i); map.put("id", jsonobj.getString("id")); ; map.put("phone_name", jsonobj.getString("phone_name")); map.put("price", jsonobj.getString("price")); mylist.add(map); } } catch (JSONException e) { Log.e("log_tag", "Error parsing data " + e.toString()); } return sret; } private void showToast(String msg, int flag) { Toast.makeText(getBaseContext(), "Result " + msg, Toast.LENGTH_LONG) .show(); } private void setListData() { listView1 = (ListView) findViewById(R.id.list1); ListAdapter adapter = new SimpleAdapter(this, mylist, R.layout.row, new String[] { "phone_name", "price" }, new int[] { R.id.phonename, R.id.price });
  12. 12. listView1.setAdapter(adapter); registerForContextMenu(listView1); } @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { menu.add(Menu.NONE, ADD_ID, Menu.NONE, "Add") .setIcon(R.drawable.ic_launcher).setAlphabeticShortcut( 'a'); menu.add(Menu.NONE, EDIT_ID, Menu.NONE, "Edit") .setIcon(R.drawable.ic_launcher).setAlphabeticShortcut( 'd'); menu.add(Menu.NONE, DELETE_ID, Menu.NONE, "Delete") .setIcon(R.drawable.ic_launcher).setAlphabeticShortcut( 'e'); } @Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item .getMenuInfo(); int idphone = (int) info.id; HashMap<String, String> o = (HashMap<String, String>) listView1 .getItemAtPosition(idphone); switch (item.getItemId()) { case ADD_ID: addData(o, "add"); return (true); case DELETE_ID: deleteData(o); return (true); case EDIT_ID: editData(o, "edit"); return (true); } return (super.onOptionsItemSelected(item)); } private void editData(HashMap<String, String> o, String action) { Log.d("****editData*****", "ïd:" + o.get("id")); callIntent(o, action); } private void deleteData(HashMap<String, String> o) { requestTask task = new requestTask(); task.applicationContext = ListDataPhoneActivity.this; task.actionflag = "delete"; String url = "http://10.0.2.2/phone/delete_phone.php?id=" + o.get("id"); task.execute(new String[] { url });
  13. 13. } private void addData(HashMap<String, String> o, String action) { callIntent(o, action); } private void callIntent(HashMap<String, String> o, String action) { Intent i = new Intent(this, AddPhoneActivity.class); i.putExtra("action", action); i.putExtra("dataphone", o); startActivityForResult(i, REQUEST_CODE); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK && requestCode == REQUEST_CODE) { if (data.hasExtra("refreshflag")) { if (data.getExtras().getString("refreshflag").equals("1")) getDataPhone(); } } } } 13.Tentunya Aplikasikita tidak hanya menampilkan data saja tetapi dapat juga menambahkan data dan mengedit data, buat class baru dengan nama AddPhoneActivity.java package net.agusharyanto.mysqlphone; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.HashMap; import android.app.Activity; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class AddPhoneActivity extends Activity { private EditText edtName; private EditText edtPrice; private Button btnSave; // Seusuaikan url dengan nama domain yang anda gunakan private String url = ""; String action=""; String phoneid=""; /** * Method yang dipanggil pada saat aplikaasi dijalankan * */ @Override public void onCreate(Bundle savedInstanceState) {
  14. 14. super.onCreate(savedInstanceState); setContentView(R.layout.add); edtName = (EditText) findViewById(R.id.edtName); edtPrice = (EditText) findViewById(R.id.edtPrice); btnSave = (Button) findViewById(R.id.btnSave); Bundle extras = getIntent().getExtras(); if (extras == null) { return; } action = extras.getString("action"); HashMap <String,String> dataphone= (HashMap<String, String>) extras.get( "dataphone" ); if (action.equals("edit")){ edtName.setText(dataphone.get("phone_name")); edtPrice.setText(dataphone.get("price")); phoneid=dataphone.get("id"); } // daftarkan even onClick pada btnSave btnSave.setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View v) { try { if (action.equals("add")){ url="http://10.0.2.2/phone/add_phone.php"; }else{ url="http://10.0.2.2/phone/edit_phone.php"; } String phone_name = URLEncoder.encode(edtName.getText() .toString(), "utf-8"); String price = URLEncoder.encode(edtPrice.getText() .toString(), "utf-8"); url += "?phone_name=" + phone_name + "&price=" + price; if (action.equals("edit")){ url+="&id="+phoneid; } Log.d("url**","url:"+url); new RequestTask().execute(url); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); } @Override public void finish() { Intent data = new Intent(); data.putExtra("refreshflag", "1"); setResult(RESULT_OK, data); super.finish(); }
  15. 15. private void setResult(String result){ Toast.makeText(getBaseContext(), result, Toast.LENGTH_LONG).show(); finish(); } class RequestTask extends AsyncTask<String, String, String>{ @Override protected String doInBackground(String... uri) { String responseString = null; responseString= HttpHelper.getRequest(uri[0]); return responseString; } @Override protected void onPostExecute(String result) { super.onPostExecute(result); setResult(result); //Do anything with response.. } } } 14.Edit AndroidManifest.xml lalu ketikan kode berikut <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="net.agusharyanto.mysqlphone" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /> <uses-permission android:name="android.permission.INTERNET" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="net.agusharyanto.mysqlphone.ListDataPhoneActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="AddPhoneActivity" android:label="Add Edit"/> </application> </manifest> 15.Sekarang mari kita jalankan programnya.
  16. 16. Tekan yang lama pada salah satu baris Akan muncul konteks menu, jika ingin menambah data sentuh ADD, untuk merubah data sentuh Edit, untuk menghapus data sentih Delete.
  17. 17. TugasBuatlah Aplikasi User Management yang inputannya terdiri dari username, password, nama_lengkap.

×