title: Que multiple dialogFragments to display one after the other
body: <p>If I have an <code>ArrayList&lt;DialogFragment&gt;</code> containing <code>DialogFragment</code>s of unknown size, how can I programmatically cue up each one so that once the first one is dismissed, the next one is shown, and so on?</p>
  
  <pre><code>for (int i = 0; i &lt; tutorialViews.size(); i++) {
      final int current = i;
      DialogFragment someDialogFragment = dialogFragmentList.get(i);
  
      if (i == 0) {
          someDialogFragment .show(activity.get().getSupportFragmentManager(), "some_dialog_fragment");
      } 
  
      if (i + 1 != dialogFragmentList.size() - 1) {
          someDialogFragment.getDialog().setOnCancelListener(new OnCancelListener() {
              @Override
              public void onCancel(DialogInterface arg0) {
                  dialogFragmentList.get(current + 1).show(activity.get().getSupportFragmentManager(), "more_dialog_fragments");
              }
          });
      }
  }
  </code></pre>
  
  <p>Unforunately this doesn't work since the <code>dialog</code> object within a <code>dialogFragment</code> isn't instantiated yet, giving a <code>nullPointerException</code> for the <code>getDialog()</code> call</p>