title: android open dialogue activity without opening main activity behind it
body: <p>Im writing a program that offers a quick reply dialog upon receipt of an SMS.</p>
  
  <p>However, I am getting an unexpected result. When I receieve an SMS, the appropriate dialog activity comes up displaying the correct phone number and message, however there is a second activity behind it that is the 'default' activity in my program (it is what opens when i launch my application)</p>
  
  <p>I do not want this second activity to come up. The quick reply activity should come up by itself over top of whatever the user was doing before.</p>
  
  <p>The 'floating' activity:</p>
  
  <pre><code>public class quickReply extends Activity {
  String mNumber, mMessage;
  TextView mMainText;
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      mMainText = (TextView)findViewById(R.id.mainText);
  
      try{
          Intent i = getIntent();
          Bundle extras = i.getExtras();
  
          mNumber = extras.getString("theNumber");
          mMessage = extras.getString("theMessage");
           this.setTitle("Message From:" + mNumber);
           mMainText.setText(mMessage);
  
  
      } catch(Exception e) {
          mMainText.setText(e.getMessage());
      }      
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>The call to the activity inside an onReceive()</p>
  
  <pre><code>        Intent i = new Intent(context, quickReply.class);
      i.putExtra("theNumber", mNumber);
      i.putExtra("theMessage", mMessage);
      i.setFlags(
              Intent.FLAG_ACTIVITY_NEW_TASK);
      context.startActivity(i);
  </code></pre>
  
  <p>The Manifest:</p>
  
  <pre><code>&lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt;
      &lt;activity android:name=".quickReply"
                android:label="@string/app_name"
                android:theme="@android:style/Theme.Dialog"
                &gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
         &lt;receiver android:name=".SmsReceiver"&gt; 
          &lt;intent-filter&gt; 
              &lt;action android:name=
                  "android.provider.Telephony.SMS_RECEIVED" /&gt; 
          &lt;/intent-filter&gt; 
      &lt;/receiver&gt;
  
  &lt;/application&gt;
  </code></pre>
  
  <p></p>