You are on page 1of 17

buatlah database dengan nama 'biodata'

buatlah tabel dengan nama 'kontak'


field ! type ! lenght ! primarykey ! auto increment !
id ! int ! 10 ! v ! v !
nama ! varchar ! 50 ! ! !
telp ! varchar ! 12 ! ! !
email ! varchar ! 50 ! ! !
buatlah folder biodata di xampp/android. buatlah folder koneksi.php, delete.php,
edit.php, update.php, insert.php

source kode koneksi.php


<?php

$server = "localhost"; // sesuaikan alamat server anda


$user = "root"; // sesuaikan user web server anda
$password = ""; // sesuaikan password web server anda
$database = "biodata"; // sesuaikan database web server anda

$connect = mysql_connect($server, $user, $password) or die ("Tidak bisa


terhubung!");
mysql_select_db($database) or die ("Database belum siap!");
?>

select.php
<?php
include "koneksi.php";

$query = mysql_query("SELECT * FROM kontak");

$json = array();

while($row = mysql_fetch_assoc($query)){
$json[] = $row;
}

echo json_encode($json);

mysql_close($connect);

?>

delete.php
<?php
include "koneksi.php";

$id = isset($_POST['id']) ? $_POST['id'] : '';

class emp{}

if (empty($id)) {
$response = new emp();
$response->success = 0;
$response->message = "Error hapus Data";
die(json_encode($response));
} else {
$query = mysql_query("DELETE FROM kontak WHERE id='".$id."'");

if ($query) {
$response = new emp();
$response->success = 1;
$response->message = "Data berhasil di hapus";
die(json_encode($response));
} else{
$response = new emp();
$response->success = 0;
$response->message = "Error hapus Data";
die(json_encode($response));
}
}
?>

edit.php
<?php
include "koneksi.php";

$id = isset($_POST['id']) ? $_POST['id'] : '';

class emp{}

if (empty($id)) {
$response = new emp();
$response->success = 0;
$response->message = "Error Mengambil Data";
die(json_encode($response));
} else {
$query = mysql_query("SELECT * FROM kontak WHERE id='".$id."'");
$row = mysql_fetch_array($query);

if (!empty($row)) {
$response = new emp();
$response->success = 1;
$response->id = $row["id"];
$response->nama = $row["nama"];
$response->tlp = $row["tlp"];
$response->email = $row["email"];
die(json_encode($response));
} else{
$response = new emp();
$response->success = 0;
$response->message = "Error Mengambil Data";
die(json_encode($response));
}
}
?>

update.php
<?php
include "koneksi.php";

$id = isset($_POST['id']) ? $_POST['id'] : '';


$nama = isset($_POST['nama']) ? $_POST['nama'] : '';
$tlp = isset($_POST['tlp']) ? $_POST['tlp'] : '';
$email = isset($_POST['email']) ? $_POST['email'] : '';

class emp{}

if (empty($id) || empty($nama) || empty($tlp) || empty($email)) {


$response = new emp();
$response->success = 0;
$response->message = "Kolom isian tidak boleh kosong";
die(json_encode($response));
} else {
$query = mysql_query("UPDATE kontak SET nama='".$nama."', tlp='".
$tlp."', email='".$email."' WHERE id='".$id."'");

if ($query) {
$response = new emp();
$response->success = 1;
$response->message = "Data berhasil di update";
die(json_encode($response));
} else{
$response = new emp();
$response->success = 0;
$response->message = "Error update Data";
die(json_encode($response));
}
}
?>

insert.php
<?php

include "koneksi.php";

$nama = isset($_POST['nama']) ? $_POST['nama'] : '';


$tlp = isset($_POST['tlp']) ? $_POST['tlp'] : '';
$email = isset($_POST['email']) ? $_POST['email'] : '';

class emp{}

if (empty($nama) || empty($tlp) || empty($email)) {


$response = new emp();
$response->success = 0;
$response->message = "Kolom isian tidak boleh kosong";
die(json_encode($response));
} else {
$query = mysql_query("INSERT INTO kontak (id,nama,tlp,email)
VALUES(0,'".$nama."','".$tlp."','".$email."')");

if ($query) {
$response = new emp();
$response->success = 1;
$response->message = "Data berhasil di simpan";
die(json_encode($response));
} else{
$response = new emp();
$response->success = 0;
$response->message = "Error simpan Data";
die(json_encode($response));
}
}
?>

buat project baru


pada build.grandle ditambahkan depencies
implementation 'com.android.support:design:28.0.0'
implementation 'com.mcxiaoke.volley:library:1.0.19'
Pada Android Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.azhar.crud">

<uses-permission android:name="android.permission.INTERNET" />


<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
android:name=".app.AppController"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />


</intent-filter>
</activity>
</application>

</manifest>

Buat MainActivity.java
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;

import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.VolleyLog;
import com.android.volley.toolbox.JsonArrayRequest;
import com.android.volley.toolbox.StringRequest;
import com.azhar.crud.adapter.KontakAdapter;
import com.azhar.crud.app.AppController;
import com.azhar.crud.data.Data;
import com.azhar.crud.util.Server;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* Created by Azhar Rivaldi on 27/06/2019.
*/

public class MainActivity extends AppCompatActivity implements


SwipeRefreshLayout.OnRefreshListener {

Toolbar toolbar;
FloatingActionButton fab;
ListView list;
SwipeRefreshLayout swipe;
List itemList = new ArrayList();
KontakAdapter adapter;
int success;
AlertDialog.Builder dialog;
LayoutInflater inflater;
View dialogView;
EditText txt_id, txt_nama, txt_tlp, txt_email;
String id, nama, tlp, email;

private static final String TAG = MainActivity.class.getSimpleName();

private static String url_select = Server.URL + "select.php";


private static String url_insert = Server.URL + "insert.php";
private static String url_edit = Server.URL + "edit.php";
private static String url_update = Server.URL + "update.php";
private static String url_delete = Server.URL + "delete.php";

public static final String TAG_ID = "id";


public static final String TAG_NAMA = "nama";
public static final String TAG_TLP = "tlp";
public static final String TAG_EMAIL = "email";
private static final String TAG_SUCCESS = "success";
private static final String TAG_MESSAGE = "message";

String tag_json_obj = "json_obj_req";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

// menghubungkan variablel pada layout dan pada java


fab = (FloatingActionButton) findViewById(R.id.fab_add);
swipe = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh_layout);
list = (ListView) findViewById(R.id.list);

// untuk mengisi data dari JSON ke dalam adapter


adapter = new KontakAdapter(MainActivity.this, itemList);
list.setAdapter(adapter);
// menamilkan widget refresh
swipe.setOnRefreshListener(this);

swipe.post(new Runnable() {
@Override
public void run() {
swipe.setRefreshing(true);
itemList.clear();
adapter.notifyDataSetChanged();
callVolley();
}
}
);

// fungsi floating action button untuk memanggil form kontak


fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
DialogForm("", "", "", "", "SIMPAN");
}
});

// listview ditekan lama akan menampilkan dua pilihan edit atau delete data
list.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {

@Override
public boolean onItemLongClick(final AdapterView parent, View view,
final int position, long id) {
// TODO Auto-generated method stub
final String idx = itemList.get(position).getId();

final CharSequence[] dialogitem = {"Edit", "Delete"};


dialog = new AlertDialog.Builder(MainActivity.this);
dialog.setCancelable(true);
dialog.setItems(dialogitem, new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
switch (which) {
case 0:
edit(idx);
break;
case 1:
delete(idx);
break;
}
}
}).show();
return false;
}
});

@Override
public void onRefresh() {
itemList.clear();
adapter.notifyDataSetChanged();
callVolley();
}

// untuk mengosongi edittext pada form


private void kosong() {
txt_id.setText(null);
txt_nama.setText(null);
txt_tlp.setText(null);
txt_email.setText(null);
}

// untuk menampilkan dialog form kontak


private void DialogForm(String idx, String namax, String tlpx, String emailx,
String button) {
dialog = new AlertDialog.Builder(MainActivity.this);
inflater = getLayoutInflater();
dialogView = inflater.inflate(R.layout.form_kontak, null);
dialog.setView(dialogView);
dialog.setCancelable(true);
dialog.setIcon(R.drawable.ic_contact);
dialog.setTitle("Kontak");

txt_id = (EditText) dialogView.findViewById(R.id.txt_id);


txt_nama = (EditText) dialogView.findViewById(R.id.txt_nama);
txt_tlp = (EditText) dialogView.findViewById(R.id.txt_tlp);
txt_email = (EditText) dialogView.findViewById(R.id.txt_email);

if (!idx.isEmpty()) {
txt_id.setText(idx);
txt_nama.setText(namax);
txt_tlp.setText(tlpx);
txt_email.setText(emailx);
} else {
kosong();
}

dialog.setPositiveButton(button, new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog, int which) {
id = txt_id.getText().toString();
nama = txt_nama.getText().toString();
tlp = txt_tlp.getText().toString();
email = txt_email.getText().toString();
simpan_update();
dialog.dismiss();
}
});

dialog.setNegativeButton("BATAL", new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
kosong();
}
});
dialog.show();
}

// untuk menampilkan semua data pada listview


private void callVolley() {
itemList.clear();
adapter.notifyDataSetChanged();
swipe.setRefreshing(true);

// membuat request JSON


JsonArrayRequest jArr = new JsonArrayRequest(url_select, new
Response.Listener() {
@Override
public void onResponse(JSONArray response) {
Log.d(TAG, response.toString());

// Parsing json
for (int i = 0; i < response.length(); i++) {
try {
JSONObject obj = response.getJSONObject(i);

Data item = new Data();

item.setId(obj.getString(TAG_ID));
item.setNama(obj.getString(TAG_NAMA));
item.setTlp(obj.getString(TAG_TLP));
item.setEmail(obj.getString(TAG_EMAIL));

// menambah item ke array


itemList.add(item);
} catch (JSONException e) {
e.printStackTrace();
}
}

// notifikasi adanya perubahan data pada adapter


adapter.notifyDataSetChanged();

swipe.setRefreshing(false);
}
}, new Response.ErrorListener() {

@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.d(TAG, "Error: " + error.getMessage());
swipe.setRefreshing(false);
}
});

// menambah request ke request queue


AppController.getInstance().addToRequestQueue(jArr);
}

// fungsi untuk menyimpan atau update


private void simpan_update() {
String url;

if (id.isEmpty()) {
url = url_insert;
} else {
url = url_update;
}

StringRequest strReq = new StringRequest(Request.Method.POST, url, new


Response.Listener() {

@Override
public void onResponse(String response) {
Log.d(TAG, "Response: " + response.toString());

try {
JSONObject jObj = new JSONObject(response);
success = jObj.getInt(TAG_SUCCESS);

// Cek error node pada json


if (success == 1) {
Log.d("Add/update", jObj.toString());

callVolley();
kosong();

Toast.makeText(MainActivity.this,
jObj.getString(TAG_MESSAGE), Toast.LENGTH_LONG).show();
adapter.notifyDataSetChanged();

} else {
Toast.makeText(MainActivity.this,
jObj.getString(TAG_MESSAGE), Toast.LENGTH_LONG).show();
}
} catch (JSONException e) {
// JSON error
e.printStackTrace();
}

}
}, new Response.ErrorListener() {

@Override
public void onErrorResponse(VolleyError error) {
Log.e(TAG, "Error: " + error.getMessage());
Toast.makeText(MainActivity.this, error.getMessage(),
Toast.LENGTH_LONG).show();
}
})

@Override
protected Map getParams() {
// Posting parameters ke post url
Map params = new HashMap();

if (id.isEmpty()) {
params.put("nama", nama);
params.put("tlp", tlp);
params.put("email", email);
} else {
params.put("id", id);
params.put("nama", nama);
params.put("tlp", tlp);
params.put("email", email);
}

return params;
}

};

AppController.getInstance().addToRequestQueue(strReq, tag_json_obj);
}

// fungsi untuk get edit data kontak


private void edit(final String idx) {
StringRequest strReq = new StringRequest(Request.Method.POST, url_edit, new
Response.Listener() {

@Override
public void onResponse(String response) {
Log.d(TAG, "Response: " + response.toString());

try {
JSONObject jObj = new JSONObject(response);
success = jObj.getInt(TAG_SUCCESS);

// Cek error pada json


if (success == 1) {
Log.d("get edit data", jObj.toString());
String idx = jObj.getString(TAG_ID);
String namax = jObj.getString(TAG_NAMA);
String tlpx = jObj.getString(TAG_TLP);
String emailx = jObj.getString(TAG_EMAIL);

DialogForm(idx, namax, tlpx, emailx, "UPDATE");

adapter.notifyDataSetChanged();

} else {
Toast.makeText(MainActivity.this,
jObj.getString(TAG_MESSAGE), Toast.LENGTH_LONG).show();
}
} catch (JSONException e) {
// JSON error
e.printStackTrace();
}

}
}, new Response.ErrorListener() {

@Override
public void onErrorResponse(VolleyError error) {
Log.e(TAG, "Error: " + error.getMessage());
Toast.makeText(MainActivity.this, error.getMessage(),
Toast.LENGTH_LONG).show();
}
}) {

@Override
protected Map getParams() {
// Posting parameters ke post url
Map params = new HashMap();
params.put("id", idx);

return params;
}

};

AppController.getInstance().addToRequestQueue(strReq, tag_json_obj);
}

// fungsi untuk menghapus


private void delete(final String idx) {
StringRequest strReq = new StringRequest(Request.Method.POST, url_delete,
new Response.Listener() {

@Override
public void onResponse(String response) {
Log.d(TAG, "Response: " + response.toString());

try {
JSONObject jObj = new JSONObject(response);
success = jObj.getInt(TAG_SUCCESS);

// Cek error pada json


if (success == 1) {
Log.d("delete", jObj.toString());

callVolley();

Toast.makeText(MainActivity.this,
jObj.getString(TAG_MESSAGE), Toast.LENGTH_LONG).show();

adapter.notifyDataSetChanged();

} else {
Toast.makeText(MainActivity.this,
jObj.getString(TAG_MESSAGE), Toast.LENGTH_LONG).show();
}
} catch (JSONException e) {
// JSON error
e.printStackTrace();
}

}
}, new Response.ErrorListener() {

@Override
public void onErrorResponse(VolleyError error) {
Log.e(TAG, "Error: " + error.getMessage());
Toast.makeText(MainActivity.this, error.getMessage(),
Toast.LENGTH_LONG).show();
}
}) {

@Override
protected Map getParams() {
// Posting parameters ke post url
Map params = new HashMap();
params.put("id", idx);

return params;
}

};

AppController.getInstance().addToRequestQueue(strReq, tag_json_obj);
}

activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.azhar.crud.MainActivity">

<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />

</android.support.design.widget.AppBarLayout>

<include layout="@layout/content_main" />

<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@drawable/ic_fab_add" />

</android.support.design.widget.CoordinatorLayout>

Buat content_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<ListView
android:id="@+id/list"
android:divider="@color/list_divider"
android:dividerHeight="2dp"
android:listSelector="@drawable/list_row_selector"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>

</android.support.v4.widget.SwipeRefreshLayout>

</RelativeLayout>

Buat form_kontak.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" >

<EditText
android:id="@+id/txt_id"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background_normal"/>

<EditText
android:id="@+id/txt_nama"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:hint="Nama"
android:singleLine="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background_normal"/>

<EditText
android:id="@+id/txt_tlp"
android:layout_marginBottom="10dp"
android:hint="Telp"
android:inputType="textMultiLine"
android:minLines="3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background_normal"/>

<EditText
android:id="@+id/txt_email"
android:layout_marginBottom="10dp"
android:hint="Email"
android:inputType="textMultiLine"
android:minLines="3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background_normal"/>

</LinearLayout>

Buat list_row.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:padding="16dp"
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:id="@+id/id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"/>

<TextView
android:id="@+id/nama"
android:layout_marginBottom="5dp"
android:textStyle="bold"
android:text="Nama"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

<TextView
android:id="@+id/tlp"
android:text="Telp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

<TextView
android:id="@+id/email"
android:text="Email"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

</LinearLayout>

Buat KontakAdapter.java
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;

import com.azhar.crud.R;
import com.azhar.crud.data.Data;
import java.util.List;

/**
* Created by Azhar Rivaldi on 27/06/2019.
*/

public class KontakAdapter extends BaseAdapter {


private Activity activity;
private LayoutInflater inflater;
private List items;

public KontakAdapter(Activity activity, List items) {


this.activity = activity;
this.items = items;
}

@Override
public int getCount() {
return items.size();
}

@Override
public Object getItem(int location) {
return items.get(location);
}

@Override
public long getItemId(int position) {
return position;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {

if (inflater == null)
inflater = (LayoutInflater)
activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

if (convertView == null) convertView = inflater.inflate(R.layout.list_row,


null);

TextView id = (TextView) convertView.findViewById(R.id.id);


TextView nama = (TextView) convertView.findViewById(R.id.nama);
TextView tlp = (TextView) convertView.findViewById(R.id.tlp);
TextView email = (TextView) convertView.findViewById(R.id.email);

Data data = items.get(position);

id.setText(data.getId());
nama.setText(data.getNama());
tlp.setText(data.getTlp());
email.setText(data.getEmail());

return convertView;
}

Buat AppController.java
import android.app.Application;
import android.text.TextUtils;

import com.android.volley.DefaultRetryPolicy;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;

/**
* Created by Azhar Rivaldi on 27/06/2019.
*/

public class AppController extends Application {

public static final String TAG = AppController.class.getSimpleName();

private RequestQueue mRequestQueue;

private static AppController mInstance;

@Override
public void onCreate() {
super.onCreate();
mInstance = this;
}

public static synchronized AppController getInstance() {


return mInstance;
}

public RequestQueue getRequestQueue() {


if (mRequestQueue == null) {
mRequestQueue = Volley.newRequestQueue(getApplicationContext());
}

return mRequestQueue;
}

public void addToRequestQueue(Request req, String tag) {


req.setTag(TextUtils.isEmpty(tag) ? TAG : tag);
req.setRetryPolicy(new DefaultRetryPolicy(0,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
getRequestQueue().add(req);
}

public void addToRequestQueue(Request req) {


req.setTag(TAG);
req.setRetryPolicy(new DefaultRetryPolicy(0,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
getRequestQueue().add(req);
}

public void cancelPendingRequests(Object tag) {


if (mRequestQueue != null) {
mRequestQueue.cancelAll(tag);
}
}

}
Data.java
public class Data {
private String id, nama, tlp, email;

public Data() {
}

public Data(String id, String nama, String tlp, String email) {


this.id = id;
this.nama = nama;
this.tlp = tlp;
this.email = email;
}

public String getId() {


return id;
}

public void setId(String id) {


this.id = id;
}

public String getNama() {


return nama;
}

public void setNama(String nama) {


this.nama = nama;
}

public String getTlp() {


return tlp;
}

public void setTlp(String tlp) {


this.tlp = tlp;
}

public String getEmail() {


return email;
}

public void setEmail(String email) {


this.tlp = email;
}
}

Server.java
public class Server {
/* Jika IP 10.0.2.2, itu adalah IP Address localhost EMULATOR ANDROID STUDIO,
Ganti IP Address tersebut dengan IP Laptop Anda. Apabila di RUN di HP. HP dan
Laptop harus 1 jaringan */
public static final String URL = "http://192.168.115.114/android/biodata/";
}

You might also like