Dilan1991

Untitled

May 13th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. private class send_absent extends AsyncTask<Void, Void, Boolean>{
  2. @Override
  3. protected void onPreExecute() {
  4. super.onPreExecute();
  5.  
  6. dialog.setCancelable(false);
  7. dialog.show();
  8.  
  9. }
  10.  
  11. @Override
  12. protected Boolean doInBackground(Void... voids) {
  13. JSONObject adb = storedata(longitude.toString(),latitude.toString(),alamat);
  14. fs = new FileTransfer();
  15. boolean status = fs.ftpReport(imageStoragePath,adb,AbsensiActivity.this);
  16.  
  17.  
  18.  
  19. return status;
  20. }
  21.  
  22. @Override
  23. protected void onPostExecute(Boolean aBoolean) {
  24. super.onPostExecute(aBoolean);
  25.  
  26. try {
  27. if (aBoolean){
  28. dialog.dismiss();
  29. new KAlertDialog(AbsensiActivity.this, KAlertDialog.SUCCESS_TYPE)
  30. .setTitleText("Success")
  31. .setContentText("Success Absent")
  32. .setConfirmText("Yes")
  33. .setConfirmClickListener(new KAlertDialog.OnSweetClickListener() {
  34. @Override
  35. public void onClick(KAlertDialog kAlertDialog) {
  36. Intent in = new Intent(AbsensiActivity.this,HistoryActivity.class);
  37. startActivity(in);
  38. finish();
  39. }
  40. })
  41. .show();
  42. }else{
  43. dialog.dismiss();
  44. new KAlertDialog(AbsensiActivity.this, KAlertDialog.ERROR_TYPE)
  45. .setTitleText("Oops...")
  46. .setContentText("Something went wrong!")
  47. .show();
  48. }
  49. }catch (Exception e){
  50. dialog.dismiss();
  51. new KAlertDialog(AbsensiActivity.this, KAlertDialog.ERROR_TYPE)
  52. .setTitleText("Oops...")
  53. .setContentText("Something went wrong! "+e)
  54. .show();
  55. }
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment