While trying to impliment How to show ProgressDialog across launching a new Activity? via @Slartibartfast's answer, I tried unsuccessfully to get it to work in my editor. Here, I am trying to display a ring progressDialog while the program fetches some contacts' information. Then, later on, in the OnCreate, it puts it in a ListView. My problem is that no progressDialog ever appears. My code is as follows:
Declaration
private ProgressDialog ringProgressDialog = null;
AsyncTask - sets off and ends the ring progressDialog
private class load_contact_list extends AsyncTask<String, Void, Integer> {
@Override
protected Integer doInBackground(String... url) {
...
}
@Override
protected void onPostExecute(Integer list_length) {
ringProgressDialog.dismiss();
setContentView(R.layout.activity_main);
}
}
OnCreate
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ringProgressDialog = ProgressDialog.show(MainActivity.this, "Loading contacts", "Please Wait", true);
new load_contact_list().execute(...);
}
...
My best efforts to make my code like his has proved in vein, I don't know why it isn't working. Thanks in advance.
EDIT: The set of ellipses in the doInBackground() is where the contact info is fetched. The other set, in the OnCreate, is where the info is put into the list.