I'm trying to have a progress dialog pop up after a user clicks on an icon, so that they are aware that the next activity (a Tag Scanner) is starting. The problem is that the progress dialog only pops up when the phone is in landscape orientation and even then the spinner isn't spinning. I've noticed that the dialog pops up sometimes in portrait orientation but it's rare and usually out of focus. I don't have control over the Tag Scanner code (the second Activity), so starting the progress dialog there is not an option. Here is the relevant code, any ideas on what to do? I've tried to start the progress dialog from the onOptionsItemSelected method but I have the same problem. I've also tried starting it from within myTask and same issue. Really lost here, any help would be appreciated
public boolean onOptionsItemSelected (MenuItem item){
switch (item.getItemId()){
case R.id.menu_scanner:
ProgressDialog progress = new ProgressDialog(this,R.style.MyDialog);
new MyTask(progress).execute();
break;
}
return false;
}
public class MyTask extends AsyncTask<Void, Void, Void> {
private ProgressDialog progress;
public MyTask(ProgressDialog progress) {
this.progress = progress;
}
public void onPreExecute() {
progress.setMessage("Loading Tag Scanner...");
progress.show();
progress.setCancelable(true);
}
public void onPostExecute(Void unused) {
TagContext.getInstance().initialize(APP_KEY, APP_VERSION, getApplicationContext());
TagContext.getInstance().launchViewfinder(
MainActivity.this, //Pass the parent activity for the viewfinder
listener, //Pass the listener to use for handling callbacks.
null);
progress.dismiss();
}
@Override
protected Void doInBackground(Void... arg0) {
return null;
}
}