I am calling this from a function by creating an object.The progress box appears and then disappears but the toast is not displayed.(I have removed the code that follows the toast but even that code which queries the web page is not executed in the doinBackground)
private class MyTask extends AsyncTask<Void, Void, Void> {
MyTask(String p) {
enter=p;
}
protected void onPreExecute() {
progressDialog = ProgressDialog.show(CheckitoutActivity.this,"", "Loading. Please wait...", true);
}
protected Void doInBackground(Void... params) {
try {
Toast.makeText(getApplicationContext(), "GHJGFHGJL",1000).show();
}
}
@Override
protected void onPostExecute(Void result) {
progressDialog.dismiss();
}
}
The doInBackground does not apppear to be called. Even the toast is not displayed.Why is that.
you can not display the UI like toast and dialog alert in doInBackground method. instead you can show these UI in postExecute method of asynkTask