Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private class send_absent extends AsyncTask<Void, Void, Boolean>{
- @Override
- protected void onPreExecute() {
- super.onPreExecute();
- dialog.setCancelable(false);
- dialog.show();
- }
- @Override
- protected Boolean doInBackground(Void... voids) {
- JSONObject adb = storedata(longitude.toString(),latitude.toString(),alamat);
- fs = new FileTransfer();
- boolean status = fs.ftpReport(imageStoragePath,adb,AbsensiActivity.this);
- return status;
- }
- @Override
- protected void onPostExecute(Boolean aBoolean) {
- super.onPostExecute(aBoolean);
- try {
- if (aBoolean){
- dialog.dismiss();
- new KAlertDialog(AbsensiActivity.this, KAlertDialog.SUCCESS_TYPE)
- .setTitleText("Success")
- .setContentText("Success Absent")
- .setConfirmText("Yes")
- .setConfirmClickListener(new KAlertDialog.OnSweetClickListener() {
- @Override
- public void onClick(KAlertDialog kAlertDialog) {
- Intent in = new Intent(AbsensiActivity.this,HistoryActivity.class);
- startActivity(in);
- finish();
- }
- })
- .show();
- }else{
- dialog.dismiss();
- new KAlertDialog(AbsensiActivity.this, KAlertDialog.ERROR_TYPE)
- .setTitleText("Oops...")
- .setContentText("Something went wrong!")
- .show();
- }
- }catch (Exception e){
- dialog.dismiss();
- new KAlertDialog(AbsensiActivity.this, KAlertDialog.ERROR_TYPE)
- .setTitleText("Oops...")
- .setContentText("Something went wrong! "+e)
- .show();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment