I’ve created an asynctask in my MapActivity, here it is:
class ReadLocations extends AsyncTask<String, String, String> {
GeoPoint apoint1;
GeoPoint apoint2;
ArrayList<GeoPoint> Locations = new ArrayList<GeoPoint>();
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(MyMapLocationActivity.this);
pDialog.setMessage("DONE");
pDialog.setIndeterminate(false);
pDialog.setCancelable(true);
pDialog.show();
}
protected String doInBackground(String... args) {
return null;
}
protected void onPostExecute() {
// dismiss the dialog once done
pDialog.dismiss();
}
}
I’m trying to execute it this way:
public class MyMapLocationActivity extends MapActivity {
private MapView mapView;
private ProgressDialog pDialog;
private ProgressDialog eDialog;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ReadLocations Read = new ReadLocations();
Read.execute();
...
My controlling dialog never disappears – it seems like my onPostExecute method is not called – why is that?
Becoz, your AsyncTask’s
onPostExecute()have not argument. which is return bydoInBackground().SO override correctly both methods.
Something like,
As possible of execution of
doInBackground()is fast because there is no any other work implementation in it. only one return statement..