title: Android: Avoid opening the dialog several times, but allow hide and shows the same dialog
body: <p>I have an <code>Activity</code> with <code>ViewPager</code> <code>PagerSlidingTabStrip</code> for each page of my <code>ViewPager</code> has a <code>fragment</code>, and in each <code>fragment</code> realize an <code>http request</code> (using <a href="https://github.com/mcxiaoke/android-volley" rel="nofollow"><code>Volley</code></a>) to load the data from the page, but when the request ends in error, type timeout or lost connection, I need to display a dialog with the option to redo the call to the server, the problem to prevent multiple dialogs are open for each error is resolved with the snippet:</p>
  
  <p>See this solution here: <a href="http://www.jorgecoca.com/android-quick-tip-avoid-opening-multiple-dialogs-when-tapping-an-element/" rel="nofollow">http://www.jorgecoca.com/android-quick-tip-avoid-opening-multiple-dialogs-when-tapping-an-element/</a></p>
  
  <pre><code>@Override
  public void show(FragmentManager manager, String tag) {
      if (manager.findFragmentByTag(tag) == null) {
        super.show(manager, tag);
      }
  }
  </code></pre>
  
  <p>When the user clicks the <code>dialog button</code> to try again, and the dialog closed and taken to check if there is internet connection, if I'm not, the dialog should be opened again, but the dialog is not displayed again, I believe that the tag does not was released to <code>FragmentManager</code>.</p>
  
  <p>Code in <code>Activity</code>:</p>
  
  <pre><code>final Button mButton = ( Button ) this.findViewById( R.id.btn_opendialog );
  
  final DialogFragmentHelper mDialog = new DialogFragmentHelper();
  mDialog.setCallbackListener( new OnCallback() {
  
      @Override
      public void onCancel() {
  
      }
  
      @Override
      public void onConfirm() {
  
          // verify if network available
  
          mDialog.show( MainActivity.this.getSupportFragmentManager(), DialogFragmentHelper.DIALOG_TAG );
      }
  } );
  
  mButton.setOnClickListener( new OnClickListener() {
  
      @Override
      public void onClick( final View v ) {
  
          mDialog.show( MainActivity.this.getSupportFragmentManager(), DialogFragmentHelper.DIALOG_TAG );
      }
  } );
  </code></pre>
  
  <p>Would someone have a suggestion of a workaround?</p>