我在我的 MapActivity 中创建了一个异步任务,它是:
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();
}
}
我正在尝试以这种方式执行它:
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();
...
我的控制对话框永远不会消失 - 似乎我的 onPostExecute 方法没有被调用 - 为什么会这样?