It is definitely working as postData sends to my site and forwards an email which it is doing. But loadingDialog does not execute ( it may be but it is a very quick process). The last process sentdialog is not executing as it brings up a new dialog saying sent and is not happening.
I have this script for the async
protected class sendReport extends AsyncTask<Void, Void, Void> {
protected void onProgressUpdate() {
progressdialog();
}
protected void onPostExecute() {
sentdialog();
loadingDialog.dismiss();
}
@Override
protected Void doInBackground(Void... arg0) {
postData();
publishProgress();
return null;
}
}
Below is the sent dialog script.
public void sentdialog(){
//set up dialog
final Dialog sentdialog = new Dialog(context);
sentdialog.setContentView(R.layout.sentdialog);
sentdialog.setTitle("Sent");
sentdialog.setCancelable(true);
final Button button = (Button) sentdialog.findViewById(R.id.Button01);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
sentdialog.dismiss();
}
});
sentdialog.show();
}
EDIT: You could just do this with a handler given activity Main:
first create ONE handler per activity:
I wrote your progressDialog, postData, sentDialog methods:
And called in onclick: