Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>With android's recent emphasis on using <a href="http://developer.android.com/guide/topics/ui/dialogs.html" rel="noreferrer">DialogFragment</a> container you <strong>wil not need to call dismiss on each</strong></p> <p>Since the dialogs will have a Fragment container you may simply use their <strong>lifecycle</strong>. Consider this DialogFragment:</p> <pre><code>public class FragDialog extends DialogFragment{ public ProgressDialog _dialog; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null) { //this.dismiss(); &lt;-- The dialogs may be dismissed here } } @Override public Dialog onCreateDialog(final Bundle savedInstanceState) { _dialog = new ProgressDialog(getActivity()); return _dialog; } @Override public void onPause() { super.onPause(); // &lt;--------- You may overload onPause } } </code></pre> <p>Which you will show in your activity using a fragmentmanager normally calling it like this:</p> <pre><code>FragmentManager fm = getSupportFragmentManager(); FragDialog fragDialog = new FragDialog(); fragDialog.show(fm, "my_tag"); </code></pre> <p>Note that you may actually alter what the DialogFragment does in onPause. When your activity calls onPause, this onPause will be called too. </p> <p>Dismissing the dialog in onPause() using this.dismiss() won't do the work because once the activity resumes it will resume the dialog as well. (I think this is because the savestate is stored prior to onPause).</p> <p>But you can safely dismiss the dialog(s) in onCreate if you detect a savedInstanceState (a resume) like shown in the code.</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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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