• Tidak ada hasil yang ditemukan

Rekomendasi

Dalam dokumen Diajukan sebagai salah satu syarat (Halaman 45-70)

2. Dengan diimplementasikannya aplikasi E-Nota akan banyak membantu dan memudahkan dalam pencatatan pengeluaran dan pemasukan barang

4.2 Rekomendasi

37

38

Lampiran :

Gambar 3.8 Source Code koneksi.java

40

Gambar 3.9 Source Code login.java

42

Gambar 3.10 Source Code JSONParser.java

44

Gambar 3.11 Source Code CustomHttpClient.java

46

package com.androidexample.cameraphotocapture;

import java.io.DataOutputStream;

import java.io.File;

import java.io.FileInputStream;

import java.io.IOException;

import java.net.HttpURLConnection;

import java.net.MalformedURLException;

import java.net.URL;

import android.net.Uri;

import android.os.AsyncTask;

import android.os.Bundle;

import android.provider.MediaStore;

import android.annotation.SuppressLint;

import android.app.Activity;

import android.app.AlertDialog;

import android.app.ProgressDialog;

import android.content.ContentValues;

import android.content.DialogInterface;

import android.content.Intent;

import android.database.Cursor;

import android.graphics.Bitmap;

import android.graphics.BitmapFactory;

import android.util.Log;

import android.view.View;

import android.view.View.OnClickListener;

import android.widget.Button;

import android.widget.ImageView;

import android.widget.TextView;

import android.widget.Toast;

@SuppressLint("NewApi")

public class CameraPhotoCapture extends Activity {

final static int CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE = 1;

Bundle ambil = new Bundle();

Uri imageUri = null;

static TextView imageDetails = null;

public static ImageView showImg = null;

CameraPhotoCapture CameraActivity = null;

Button btUpload, photo, ref, btnExit;

TextView messageText;

int serverResponseCode = 0;

ProgressDialog dialog = null;

String upLoadServerUri = null;

public static String myPath, myUrl;

final String uploadFilePath = "";

final String uploadFileName = "";

public static String fileName;

Bundle a = new Bundle();

Intent i = new Intent();

koneksi konek = new koneksi();

public void myDelete(String path){

File myFile = new File(path);

myFile.delete();

//Toast.makeText(CameraPhotoCapture.this, "Ok", Toast.LENGTH_LONG).show();

}

public void onClick(DialogInterface dialog, int which) {

i = new Intent(CameraPhotoCapture.this, display_beli.class);

a.putString("dedi", fileName);

a.putString("myLink", myUrl);

i.putExtras(a);

startActivity(i);

CameraPhotoCapture.this.finish();

}

}).setNegativeButton("Penjualan", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) {

i = new Intent(CameraPhotoCapture.this, display_jual.class);

a.putString("dedi", fileName);

a.putString("myLink", myUrl);

i.putExtras(a);

startActivity(i);

CameraPhotoCapture.this.finish();

} }).show(); }

public int uploadFile(String sourceFileUri){ fileName = myPath;

sourceFileUri = myPath;

HttpURLConnection conn = null; DataOutputStream dos = null; String lineEnd =

"\r\n";

String twoHyphens = "--"; String boundary = "*****"; int bytesRead, bytesAvailable, bufferSize;

byte[] buffer;

int maxBufferSize = 1 * 1024 * 1024; File sourceFile = new File(sourceFileUri);

if (!sourceFile.isFile()) {

dialog.dismiss(); Log.e("uploadFile", "Source File not exist :"

+uploadFilePath + "" + uploadFileName);

runOnUiThread(new Runnable() { public void run() {

messageText.setText("Source File not exist :"

+uploadFilePath + "" + uploadFileName);

} });

return 0; }

else { try { FileInputStream fileInputStream = new FileInputStream(sourceFile);

URL url = new URL(upLoadServerUri);

conn = (HttpURLConnection) url.openConnection();

conn.setDoInput(true);

conn.setDoOutput(true);

conn.setUseCaches(false);

conn.setRequestMethod("POST");

conn.setRequestProperty("Connection", "Keep-Alive");

conn.setRequestProperty("ENCTYPE", "multipart/form-data");

conn.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary);

conn.setRequestProperty("uploaded_file", fileName);

// String pasti="dedi";

dos = new DataOutputStream(conn.getOutputStream());

dos.writeBytes(twoHyphens + boundary + lineEnd);

dos.writeBytes("Content-Disposition: form-data; name=\"uploaded_file\";filename=\""

+ fileName+ "\"" + lineEnd);

48

return 0;

} else {

try {

FileInputStream fileInputStream = new FileInputStream(sourceFile);

URL url = new URL(upLoadServerUri);

conn = (HttpURLConnection) url.openConnection();

conn.setDoInput(true);

conn.setDoOutput(true);

conn.setUseCaches(false);

conn.setRequestMethod("POST");

conn.setRequestProperty("Connection", "Keep-Alive");

conn.setRequestProperty("ENCTYPE", "multipart/form-data");

conn.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary);

conn.setRequestProperty("uploaded_file", fileName);

// String pasti="dedi";

dos = new DataOutputStream(conn.getOutputStream());

dos.writeBytes(twoHyphens + boundary + lineEnd);

dos.writeBytes("Content-Disposition: form-data; name=\"uploaded_file\";filename=\""

+ fileName+ "\"" + lineEnd);

/*dos.writeBytes("Content-Disposition: form-data; name=\"uploaded_file\";filename=\""

+ "akui"+ "\"" + lineEnd);*/

dos.writeBytes(lineEnd);

bytesAvailable = fileInputStream.available();

bufferSize = Math.min(bytesAvailable, maxBufferSize);

buffer = new byte[bufferSize];

// read file and write it into form...

bytesRead = fileInputStream.read(buffer, 0, bufferSize);

while (bytesRead > 0) { dos.write(buffer, 0, bufferSize);

bytesAvailable = fileInputStream.available();

bufferSize = Math.min(bytesAvailable, maxBufferSize);

bytesRead = fileInputStream.read(buffer, 0, bufferSize);

}

// send multipart form data necesssary after file data...

dos.writeBytes(lineEnd);

dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);

// Responses from the server (code and message) serverResponseCode = conn.getResponseCode();

String serverResponseMessage = conn.getResponseMessage();

Log.i("uploadFile", "HTTP Response is : "

+ serverResponseMessage + ": " + serverResponseCode);

if(serverResponseCode == 200){

runOnUiThread(new Runnable() { public void run() {

String msg = "File Upload Completed.";

messageText.setText(msg);

choiceUpload();

} });

} //close the streams //

fileInputStream.close();

dos.flush();

dos.close();

runOnUiThread(new Runnable() { public void run() {

messageText.setText("MalformedURLException Exception : check script url.");

Toast.makeText(CameraPhotoCapture.this, "MalformedURLException", Toast.LENGTH_SHORT).show();

} });

Log.e("Upload file to server", "error: " + ex.getMessage(), ex);

} catch (Exception e) { dialog.dismiss();

e.printStackTrace();

runOnUiThread(new Runnable() { public void run() {

messageText.setText("Got Exception : see logcat ");

Toast.makeText(CameraPhotoCapture.this, "Got Exception : see logcat ", Toast.LENGTH_SHORT).show();

} });

Log.e("Upload file to server Exception", "Exception : "

+ e.getMessage(), e);

}

dialog.dismiss();

return serverResponseCode;

} // End else block }

protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

setContentView(R.layout.activity_camera_photo_capture);

CameraActivity = this;

ambil = getIntent().getExtras();

myUrl = ambil.getString("myLink");

konek.myKoneksi(myUrl);

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

showImg = (ImageView) findViewById(R.id.showImg);

btUpload = (Button) findViewById(R.id.btnUpload);

photo = (Button) findViewById(R.id.photo);

btnExit = (Button) findViewById(R.id.btn_exit);

btnExit.setOnClickListener(new OnClickListener() { public void onClick(View arg0) {

CameraPhotoCapture.this.finish();

}

});ref = (Button) findViewById(R.id.btnRefresh);

ref.setOnClickListener(new OnClickListener() { public void onClick(View arg0) {

myDelete(myPath);

Intent i = new Intent();

i = new Intent(CameraPhotoCapture.this, CameraPhotoCapture.class);

a.putString("myLink", myUrl);

50

i.putExtras(a);

startActivity(i);

} });

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

upLoadServerUri = konek.kon_upload();

//upLoadServerUri = "http://192.168.43.135/media/UploadToServer.php";

btUpload.setOnClickListener(new OnClickListener() { public void onClick(View arg0) {

dialog = ProgressDialog.show(CameraPhotoCapture.this, "",

"Uploading file...", true);

new Thread(new Runnable() { public void run() {

runOnUiThread(new Runnable() { public void run() {

messageText.setText("uploading started...");

}

});

uploadFile(uploadFilePath + "" + uploadFileName);

} }).start();

//myMessage();// pesan hapus file;

} });

photo.setOnClickListener(new OnClickListener() { public void onClick(View v) {

/***** Define the file-name to save photo taken by Camera activity *******/

String fileName = "";

btUpload.setEnabled(true);

photo.setEnabled(false);

// Create parameters for Intent with filename

ContentValues values = new ContentValues();

values.put(MediaStore.Images.Media.TITLE, fileName);

values.put(MediaStore.Images.Media.DESCRIPTION,"Image capture by camera");

/****** imageUri is the current activity attribute, define and save it for later usage

*****/

imageUri = getContentResolver().insert(

MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);

/****** EXTERNAL_CONTENT_URI : style URI for the "primary" external storage volume. ******/

/****** Standard Intent action that can be sent to have the camera application capture an image and return it. ******/

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);

intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);

startActivityForResult(intent,

CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE); } }); }

if (resultCode == RESULT_OK) {

String imageId = convertImageUriToFile(imageUri,CameraActivity);

new LoadImagesFromSDCard().execute(""+imageId);

} else if (resultCode == RESULT_CANCELED) {

Toast.makeText(this, "Picture was not taken", Toast.LENGTH_SHORT).show();

} else {

Toast.makeText(this, "Picture was not taken", Toast.LENGTH_SHORT).show();

} } }

public static String convertImageUriToFile (Uri imageUri, Activity activity) { Cursor cursor = null;

int imageID = 0;

try {

/*********** Which columns values want to get *******/

String [] proj={

MediaStore.Images.Media.DATA,

MediaStore.Images.Media._ID,

MediaStore.Images.Thumbnails._ID,

MediaStore.Images.ImageColumns.ORIENTATION

};

cursor = activity.managedQuery(

imageUri, // Get data for specific

image URI

proj, // Which columns to return

null, // WHERE clause; which rows to return (all rows) null, // WHERE clause selection arguments (none) null // Order-by clause (ascending by name)

);

int columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media._ID);

int columnIndexThumb =

cursor.getColumnIndexOrThrow(MediaStore.Images.Thumbnails._ID);

int file_ColumnIndex =

cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);

//int orientation_ColumnIndex =

cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.ORIENTATION);

int size = cursor.getCount();

/******* If size is 0, there are no images on the SD Card. *****/

if (size == 0) {

imageDetails.setText("No Image");

}

52

else

{

int thumbID = 0;

if (cursor.moveToFirst()) {

/**************** Captured image details ************/

/***** Used to show image on view in LoadImagesFromSDCard class ******/

imageID = cursor.getInt(columnIndex);

thumbID = cursor.getInt(columnIndexThumb);

myPath = cursor.getString(file_ColumnIndex);

//String orientation = cursor.getString(orientation_ColumnIndex);

String CapturedImageDetails = " CapturedImageDetails : \n\n"

+" ImageID :"+imageID+"\n"

+" ThumbID :"+thumbID+"\n"

+" Path :"+myPath+"\n";

// Show Captured Image detail on view imageDetails.setText(CapturedImageDetails);

} }

} finally {

if (cursor != null) { cursor.close();

} }

return ""+imageID;

} /**

* Async task for loading the images from the SD card.

*

* @author Android Example *

*/

// Class with extends AsyncTask class

public class LoadImagesFromSDCard extends AsyncTask<String, Void, Void> {

private ProgressDialog Dialog = new ProgressDialog(CameraPhotoCapture.this);

Bitmap mBitmap;

protected void onPreExecute() {

/****** NOTE: You can call UI Element here. *****/

//UI Element

Dialog.setMessage("Loading image from Sdcard..");

Dialog.show();

}

// Call after onPreExecute method

protected Void doInBackground(String... urls) {

Bitmap bitmap = null;

Bitmap newBitmap = null;

Uri uri = null;

try {

/** Uri.withAppendedPath Method Description * Parameters

* baseUri Uri to append path segment to * pathSegment encoded path segment to append * Returns

* a new Uri based on baseUri with the given segment appended to the path */

uri =

Uri.withAppendedPath(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "" + urls[0]);

/************** Decode an input stream into a bitmap. *********/

bitmap = BitmapFactory.decodeStream(getContentResolver().openInputStream(uri));

if (bitmap != null) {

/********* Creates a new bitmap, scaled from an existing bitmap.

***********/

newBitmap = Bitmap.createScaledBitmap(bitmap, 170, 170, true);

bitmap.recycle();

if (newBitmap != null) {

mBitmap = newBitmap;

} }

} catch (IOException e) {

//Error fetching image, try to recover

/********* Cancel execution of this task. **********/

cancel(true);

}

return null;

}

protected void onPostExecute(Void unused) {

// NOTE: You can call UI Element here.

// Close progress dialog Dialog.dismiss();

if(mBitmap != null)

showImg.setImageBitmap(mBitmap);

} }

}

Gambar 3.12 Source Code CameraPhotoCapture.java

54

package com.androidexample.cameraphotocapture;

import java.util.ArrayList;

import java.util.HashMap;

import org.apache.http.NameValuePair;

import org.apache.http.message.BasicNameValuePair;

import org.json.JSONArray;

import org.json.JSONObject;

import android.annotation.SuppressLint;

import android.annotation.TargetApi;

import android.app.Activity;

import android.app.AlertDialog;

import android.content.DialogInterface;

import android.content.Intent;

import android.os.Build;

import android.os.Bundle;

import android.os.StrictMode;

import android.view.View;

import android.widget.AdapterView;

import android.widget.AdapterView.OnItemClickListener;

import android.widget.ListAdapter;

import android.widget.ListView;

import android.widget.SimpleAdapter;

import android.widget.TextView;

import android.widget.Toast;

@SuppressLint("NewApi")

@TargetApi(Build.VERSION_CODES.GINGERBREAD)

public class display_beli extends Activity implements OnItemClickListener{

CameraPhotoCapture cpc = new CameraPhotoCapture();

ListView ListData;

String tmp, myUrl;

ArrayList<HashMap<String, String>> AdapterData = new ArrayList<HashMap<String, String>>();

Bundle ambil ; Intent o ;

String display_beli = "1";

Bundle a = new Bundle();

koneksi konek = new koneksi();

protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

setContentView(R.layout.display);

ListData = (ListView) findViewById(R.id.listData);

ListData.setOnItemClickListener(this);

ambil = getIntent().getExtras();

tmp = ambil.getString("dedi");

myUrl = ambil.getString("myLink");

konek.myKoneksi(myUrl);

try{

if (android.os.Build.VERSION.SDK_INT > 9) { StrictMode.ThreadPolicy policy =new StrictMode.ThreadPolicy.Builder().permitAll().build();

StrictMode.setThreadPolicy(policy);

}

JSONParser jparser = new JSONParser(); //deklarasi json parsing JSONObject jobject = jparser.getJSONFromUrl(konek.kon_beli());

//AdapterData = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, data);

//ListData.setAdapter(AdapterData);

JSONArray DataArray = jobject.getJSONArray("list_data");

for(int i=0; i<DataArray.length(); i++){

HashMap<String, String> map = new HashMap<String, String>(); //deklarasi variabel array 2 dimensi

JSONObject jsonobj = DataArray.getJSONObject(i);

//Mengambil data berdasarkan index ke-i

map.put("kd_beli", jsonobj.getString("kode_beli"));

map.put("tg_beli", jsonobj.getString("tgl_beli"));

map.put("kd_brg", jsonobj.getString("kode_barang"));

AdapterData.add(map);

}

ListAdapter adaptor = new SimpleAdapter(this, AdapterData, R.layout.row,

new String[] { "kd_beli", "kd_brg", "tg_beli" }, new int[] { R.id.kd_jual, R.id.kd_brg, R.id.tgl_jual } //name-nim nama attribut txt layout

);

ListData.setAdapter(adaptor);

}

catch (Exception e) {

Toast.makeText(this, "What wrong "+e, Toast.LENGTH_LONG).show();

} }

public void onItemClick(AdapterView<?> arg0, final View view, int arg2, long arg3) { final String kd_transaksi = ((TextView)

view.findViewById(R.id.kd_jual)).getText().toString();

//final String kd_brg = ((TextView) view.findViewById(R.id.kd_brg)).getText().toString();

Toast.makeText(display_beli.this, kd_transaksi, Toast.LENGTH_SHORT).show();

56

new AlertDialog.Builder(this).setTitle("Actions").setPositiveButton("Upload", new DialogInterface.OnClickListener() {

public void onClick(DialogInterface dialog, int which) { try{

String result = null;

ArrayList<NameValuePair> postData = new ArrayList<NameValuePair>(); // deklarasi array list

postData.add(new BasicNameValuePair("kode_transaksi", kd_transaksi));

postData.add(new BasicNameValuePair("path", tmp));

//postData.add(new BasicNameValuePair("keterangan", display_beli));

//postData.add(new BasicNameValuePair("kode_barang", kd_brg));

result =

CustomHttpClient.executeHttpPost(konek.kon_upload(), postData);

String timpy = result.toString();

Toast.makeText(display_beli.this, timpy , Toast.LENGTH_LONG).show();

cpc.myDelete(tmp);

o = new Intent(display_beli.this, CameraPhotoCapture.class);

a.putString("myLink", myUrl);

o.putExtras(a);

startActivity(o);

display_beli.this.finish();

}catch (Exception e) {

Toast.makeText(display_beli.this, "What error ? "+e , Toast.LENGTH_LONG).show();

} }

}).setNegativeButton("Back", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) {

}

}).setNeutralButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) {

try {

cpc.myDelete(tmp);

JSONParser jparsere = new JSONParser(); //deklarasi json parsing

jparsere.getJSONFromUrl(konek.hapus()+"?name_file="+tmp);

o = new Intent(display_beli.this, CameraPhotoCapture.class);

a.putString("myLink", myUrl);

o.putExtras(a); startActivity(o);

display_beli.this.finish();

} catch (Exception e) {

Toast.makeText(display_beli.this, "What's up error? "+e, Toast.LENGTH_LONG).show();

} }}).show();}}

Gambar 3.13 Source Code display_beli.java

import java.util.ArrayList;

import java.util.HashMap;

import org.apache.http.NameValuePair;

import org.apache.http.message.BasicNameValuePair;

import org.json.JSONArray;

import org.json.JSONObject;

import android.annotation.SuppressLint;

import android.annotation.TargetApi;

import android.app.Activity;

import android.app.AlertDialog;

import android.content.DialogInterface;

import android.content.Intent;

import android.os.Build;

import android.os.Bundle;

import android.os.StrictMode;

import android.view.View;

import android.widget.AdapterView;

import android.widget.AdapterView.OnItemClickListener;

import android.widget.ListAdapter;

import android.widget.ListView;

import android.widget.SimpleAdapter;

import android.widget.TextView;

import android.widget.Toast;

@SuppressLint("NewApi")

@TargetApi(Build.VERSION_CODES.GINGERBREAD)

public class display_jual extends Activity implements OnItemClickListener{

CameraPhotoCapture cpc = new CameraPhotoCapture();

ListView ListData;

String tmp, myUrl;

ArrayList<HashMap<String, String>> AdapterData = new ArrayList<HashMap<String, String>>();

Bundle a = new Bundle();

Intent o ;

String display_jual = "0";

koneksi konek = new koneksi();

protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

setContentView(R.layout.display);

ListData = (ListView) findViewById(R.id.listData);

ListData.setOnItemClickListener(this);

a = getIntent().getExtras();

tmp = a.getString("dedi");

myUrl = a.getString("myLink");

konek.myKoneksi(myUrl);

try{

if (android.os.Build.VERSION.SDK_INT > 9) { StrictMode.ThreadPolicy policy =new StrictMode.ThreadPolicy.Builder().permitAll().build();

StrictMode.setThreadPolicy(policy);

}

58

JSONParser jparser = new JSONParser(); //deklarasi json parsing JSONObject jobject = jparser.getJSONFromUrl(konek.kon_jual());

//AdapterData = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, data);

//ListData.setAdapter(AdapterData);

JSONArray DataArray = jobject.getJSONArray("list_data");

for(int i=0; i<DataArray.length(); i++){

HashMap<String, String> map = new HashMap<String, String>(); //deklarasi variabel array 2 dimensi

JSONObject jsonobj = DataArray.getJSONObject(i);

//Mengambil data berdasarkan index ke-i

map.put("kd_jual", jsonobj.getString("kode_jual"));

map.put("tg_jual", jsonobj.getString("tgl_jual"));

map.put("kd_brg", jsonobj.getString("kode_barang"));

AdapterData.add(map);

}

ListAdapter adaptor = new SimpleAdapter(this, AdapterData, R.layout.row,

new String[] { "kd_jual", "kd_brg", "tg_jual" }, new int[] { R.id.kd_jual, R.id.kd_brg,

R.id.tgl_jual } //name-nim nama attribut txt layout );

ListData.setAdapter(adaptor);

}

catch (Exception e) {

Toast.makeText(this, "What wrong "+e, Toast.LENGTH_LONG).show();

} }

public void onItemClick(AdapterView<?> arg0, final View view, int arg2, long arg3) { final String kd_transaksi = ((TextView)

view.findViewById(R.id.kd_jual)).getText().toString();

//final String kd_brg = ((TextView) view.findViewById(R.id.kd_brg)).getText().toString();

Toast.makeText(display_jual.this, kd_transaksi, Toast.LENGTH_SHORT).show();

new AlertDialog.Builder(this).setTitle("Actions").setPositiveButton("Upload", new DialogInterface.OnClickListener() {

public void onClick(DialogInterface dialog, int which) { try{

String result = null;

ArrayList<NameValuePair> postData = new ArrayList<NameValuePair>(); // deklarasi array list

postData.add(new BasicNameValuePair("kode_transaksi", kd_transaksi));

postData.add(new BasicNameValuePair("path", tmp));

//postData.add(new BasicNameValuePair("keterangan", display_jual));

//postData.add(new BasicNameValuePair("kode_barang", kd_brg));

result =

CustomHttpClient.executeHttpPost(konek.kon_upload(), postData);

String timpy = result.toString();

a.

Toast.makeText(display_jual.this, timpy , Toast.LENGTH_LONG).show();

cpc.myDelete(tmp);

o = new Intent(display_jual.this, CameraPhotoCapture.class);

a.putString("myLink", myUrl);

o.putExtras(a);

startActivity(o);

display_jual.this.finish();

}catch (Exception e) {

Toast.makeText(display_jual.this, "What error ? "+e , Toast.LENGTH_LONG).show();

} }

}).setNegativeButton("Back", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) {

}

}).setNeutralButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) {

try {

cpc.myDelete(tmp);

JSONParser jparsere = new JSONParser(); //deklarasi json parsing

jparsere.getJSONFromUrl(konek.hapus()+"?name_file="+tmp);

o = new Intent(display_jual.this, CameraPhotoCapture.class);

a.putString("myLink", myUrl);

o.putExtras(a);

startActivity(o);

display_jual.this.finish();

} catch (Exception e) {

Toast.makeText(display_jual.this, "What's up error? "+e, Toast.LENGTH_LONG).show();

} }

}).show();

} }

Gambar 3.14 Source Code display_beli.java

60

Gambar 3.15 Source Code connect.php

Gambar 3.16 Source Code del_file.php

Gambar 3.17 Source Code display_jual.php

Gambar 3.18 Source Code display_beli.php

Dalam dokumen Diajukan sebagai salah satu syarat (Halaman 45-70)

Dokumen terkait