title: AlertDialog.Builder not displaying buttons from setUserVisibleHint(boolean) in Fragment
body: <p>I'm trying to make an <code>AlertDialog</code> that displays when a <code>Fragment</code> is visible using <code>setUserVisibleHint(boolean)</code>, that tells the user to switch on their GPS settings.  I am using this code:</p>
  
  <pre><code>new AlertDialog.Builder(getActivity())
  .setTitle(R.string.dialogLocationDisabledTitle)
  .setMessage(R.string.dialogLocationDisabledMsg)
  .setCancelable(true)
  .setPositiveButton(R.string.gpssettings, new DialogInterface.OnClickListener() {
  
      @Override
      public void onClick(DialogInterface dialog, int which) {
          startActivity(new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS));
          mRecheckLocationOnResume = true;
      }
  })
  .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
  
      @Override
      public void onClick(DialogInterface dialog, int which) {
      }
  })
  .create()
  .show();
  </code></pre>
  
  <p>However, when you enter the app with GPS disabled, and go to the screen, neither button displays.  When you enter the app, switch off GPS, then go to the screen, it works fine.  Can anyone suggest why?</p>
  
  <p>EDIT:  at the suggestion of @pax2K, I include a snippet of logcat.  I added logging statements into the above code:</p>
  
  <pre><code>03-19 16:05:40.062: D/LocateServiceFragment(11193): Starting AlertDialog build
  03-19 16:05:40.062: D/LocateServiceFragment(11193): Adding positive button
  03-19 16:05:40.072: D/LocateServiceFragment(11193): Adding negative button
  03-19 16:05:40.072: D/LocateServiceFragment(11193): Building AlertDialog
  03-19 16:05:40.072: D/LocateServiceFragment(11193): Showing AlertDialog
  03-19 16:05:40.182: D/LocateServiceFragment(11193): AlertDialog shown
  03-19 16:05:40.803: I/Adreno200-EGLSUB(11193): &lt;ConfigWindowMatch:2089&gt;: Format RGBX_8888.
  03-19 16:05:40.903: I/Adreno200-EGLSUB(11193): &lt;ConfigWindowMatch:2078&gt;: Format RGBA_8888.
  03-19 16:05:41.123: D/dalvikvm(11193): GC_FOR_ALLOC freed 1560K, 19% free 17223K/21219K, paused 48ms
  03-19 16:05:41.363: D/OpenGLRenderer(11193): has fontRender patch
  03-19 16:05:42.084: D/memalloc(11193): ashmem: Mapped buffer base:0x5576b000 size:737280 fd:166
  03-19 16:05:45.668: D/memalloc(11193): /dev/pmem: Unmapping buffer base:0x56ff8000 size:16613376 offset:15998976
  03-19 16:05:45.668: D/memalloc(11193): /dev/pmem: Unmapping buffer base:0x53882000 size:614400 offset:0
  03-19 16:05:45.668: D/memalloc(11193): /dev/pmem: Unmapping buffer base:0x57fd0000 size:1966080 offset:1351680
  03-19 16:05:45.958: D/memalloc(11193): /dev/pmem: Unmapping buffer base:0x5857d000 size:4239360 offset:3502080
  03-19 16:05:45.958: D/memalloc(11193): /dev/pmem: Unmapping buffer base:0x55e8a000 size:1351680 offset:614400
  03-19 16:05:46.178: D/OpenGLRenderer(11193): Flushing caches (mode 1)
  </code></pre>
  
  <p>Either side are debug statements from completely different parts of the code.  I am not much the wiser.</p>