title: Showing DialogFragment without the calling Activity as background
body: <p>I am using the <code>AlarmManager</code> to pass a <code>PendingIntent</code> to my <code>BroadcastReceiver</code> after, say, 5 minutes. Now, I want to show a <code>DialogFragment</code> to the user, on top of whatever app the user might be using when the alarm goes off. For example, if the user is using Chrome when the alarm goes off, my <code>DialogFragment</code> should popup ABOVE the user's Chrome window.</p>
  
  <p>What I am ending up with instead, is the <code>DialogFragment</code> being shown with a blank activity of my app as the background (as in the following pic)</p>
  
  <p><a href="http://i.stack.imgur.com/Vz9IZ.png" rel="nofollow">http://i.stack.imgur.com/Vz9IZ.png</a></p>
  
  <p>This is the code I am using in my <code>BroadcastReceiver</code>, to launch an <code>FragmentActivity</code> first :</p>
  
  <pre><code>    public class AlarmReceiver extends BroadcastReceiver {
  
          @Override
          public void onReceive(Context context, Intent intent)
          {
              Intent hardReminderIntent = new Intent(context, AlarmHardActivity.class);
              hardReminderIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
              context.startActivity(hardReminderIntent);
  
          }
  }
  </code></pre>
  
  <p> </p>
  
  <p>Next, from this activity, I am popping up the <code>DialogFragment</code> :</p>
  
  <pre><code>public class AlarmHardActivity extends FragmentActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          FragmentManager fm = getSupportFragmentManager();
          AlarmHardDialog editNameDialog = new AlarmHardDialog();
          editNameDialog.show(fm, "fragment_dialog");
          //setContentView(R.layout.activity_alarm_hard);
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          //getMenuInflater().inflate(R.menu.activity_alarm_hard, menu);
          return true;
      }
  
  }
  </code></pre>
  
  <p><strong>My questions :</strong></p>
  
  <ol>
  <li><p>I could not find a way to call <code>getSupportFragmentManager</code> directly from the <code>onReceive</code> in my <code>BroadcastReceiver</code>, and thus assumed that the only way to obtain a dialog, would be to first call a 'dummy' activity, that creates the dialog. Is there a better way to do this?</p></li>
  <li><p>Irrespective of whether or not my approach was correct, I expected that since there is no call to <code>setContentView(..)</code> in AlarmHardActivity, there would be no UI rendered for it. Is my understanding wrong? I also tried calling <code>setContentView(..)</code> and then marking the layout to have <code>Theme.NoDisplay</code> and <code>android:alpha="0"</code>, but to no avail.</p></li>
  </ol>
  
  <p>Any help will be much appreciated. Thanks!</p>