Note that there are some explanatory texts on larger screens.

plurals
  1. POProgressDialog doesn't show after clicking HOME and returning to App
    primarykey
    data
    text
    <p>In my onCreate, the following code executes:</p> <pre><code>dialog = new ProgressDialog(this); dialog.setCancelable(false); dialog.setCanceledOnTouchOutside(false); dialog.setMessage("Welcome! Initializing database... This will take just a minute"); dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); dialog.setMax(100); dialog.setProgress(0); dialog.show(); </code></pre> <p>The dialog should only go away once an AsyncTask completes. If I click home and then return to the application the ProgressDialog should still be there, and in fact, that's what happens in the emulator. On my HTC Evo, however, the dialog does not show if I click home and return to the app.</p> <p>I also have:</p> <pre><code>@Override protected void onRestart() { super.onRestart(); try { dialog.show(); } catch(Exception e) {} } </code></pre> <p>Any ideas as to what could be causing this?</p> <p><strong>Updated (most relevant code):</strong></p> <pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext = this; RecipeDbAdapter rdAdapter; int recipesInDb = 0; // Binds automatically to "@android:id/list" setContentView(R.layout.country_list); setListAdapter(new EfficientAdapter(this)); handler = new Handler() { public void handleMessage(Message msg) { Bundle b = msg.getData(); String type = b.getString("type"); String data = b.getString("data"); // If message received to advance dialog (called during initial db load) try { if (type.equals("dialog")) { dialog.incrementProgressBy(Integer.parseInt(data)); if (dialog.getProgress() &gt;= dialog.getMax()) { dialog.setProgress(dialog.getMax()); currentlyLoadingFromDb = false; dialog.dismiss(); dialog = null; } } else if (type.equals("update")) { updateLastRecipeUpdateDate(); } } catch (Exception e) { } } }; try { rdAdapter = new RecipeDbAdapter(Countries.this); rdAdapter.open(); recipesInDb = rdAdapter.fetchAllRecipesCount(); rdAdapter.close(); // Initialize database of recipes if (recipesInDb == 0) { currentlyLoadingFromDb = true; dialog = new ProgressDialog(this); dialog.setCancelable(false); dialog.setCanceledOnTouchOutside(false); dialog.setMessage("Welcome! Initializing database of recipes... This will take just a minute"); dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); dialog.setMax(100); dialog.setProgress(0); dialog.show(); updateLastRecipeUpdateDate(); loadAT = new LoadDatabaseTask().execute(""); } rdAdapter.close(); } catch (Exception e) { } } @Override protected void onPause() { try { dialog.dismiss(); } catch(Exception e) {} super.onPause(); } @Override protected void onResume() { super.onResume(); if (dialog!=null) try { dialog.show(); } catch(Exception e) {} } @Override protected void onDestroy() { super.onDestroy(); } </code></pre> <p>} `</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload