I have a listview which have checkboxes. For each checkbox (they are about 3), it has a specific AsyncTask for it.
I never know what checkboxes use
alert dialog is foreground thing so it can not be done in background method of async task. Do it by this way
private class showMessageAsync extends AsyncTask {
AlertDialog alertDialog;
protected void onPreExecute() {
super.onPreExecute();
alertDialog = new AlertDialog.Builder(YourClasss.this);
}
@Override
protected String doInBackground(Void... params){
return null;
}
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
alertDialog.setTitle("The Process");
alertDialog.setIcon(R.drawable.success);
alertDialog.setCanceledOnTouchOutside(false);
alertDialog.setMessage("All done!");
alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Intent A = new Intent(DownloadActivity.this, Menu_activity.class);
startActivity(A);
finish();
}
});
alertDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
Intent A = new Intent(DownloadActivity.this, Menu_activity.class);
startActivity(A);
finish();
}
});
alertDialog.show();
}
}