launching a dialog box without main application bellow
<p>I built an application that has an activity that i want to start from the click of a status notification icon. What i want to happen is for my activity which i set to be shown as a dialog box to show up on top of whatever application is already open on the device.</p>

<p>But what happens now is that when the notification icon is clicked the dialog activity is launched along with the applications main activity underneath it, as seem in the image bellow.</p>

<p><a href="http://postimage.org/image/s40v1588b/" rel="nofollow">http://postimage.org/image/s40v1588b/</a></p>

<p>How can i launch the dialog box so that it shows up over the current application on screen and my main activity isn't launched?</p>

<p>Main Activity:</p>

<pre><code>public class mainActivity extends Activity {
    public  NotificationManager mNotificationManager;
    private Button start;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
        start = (Button) findViewById(R.id.start);
        start.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                Intent myIntent = new Intent(getApplicationContext(), servicetest.class);
                startService(myIntent);
                Log.d("start","sms");
                Toast.makeText(SmseverywhereActivity.this, "Service Started",
                        Toast.LENGTH_LONG).show();
            }

        });

    }

}
</code></pre>

<p>Service that listens for notification press and starts dialog activity:</p>

<pre><code>    public class servicetest extends Service{
        public  NotificationManager mNotificationManager;
        public Intent dialogIntent;

        @Override
        public IBinder onBind(Intent intent) {
            // TODO Auto-generated method stub
            return null;
        }
        @Override
        public void onCreate() {
            super.onCreate();
            Log.d("servicetest","onCreate");
            mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
            showNotification();


            }


         private void showNotification(){
                Notification not = new Notification(R.drawable.ic_launcher, "Application started", System.currentTimeMillis());
                Intent myIntent = new Intent(this, dialogactivity.class);
                myIntent.putExtra("isFullScreen", true);
                myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

                PendingIntent contentIntent = PendingIntent.getActivity(this, 0, myIntent, Notification.FLAG_ONGOING_EVENT);        
                not.flags = Notification.FLAG_ONGOING_EVENT;            
                not.setLatestEventInfo(this, "Application Name", "Application Description", contentIntent);
                mNotificationManager.notify(1, not);
            }



    }

Dialog activity:
public class dialogactivity extends Activity{
     @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            requestWindowFeature(Window.FEATURE_NO_TITLE);
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
            setContentView(R.layout.dialogtest);

     }
}
</code></pre>

<p>manifest:</p>

<pre><code>&lt;application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" &gt;
        &lt;activity
            android:name=".SmseverywhereActivity"
            android:label="@string/app_name" &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;activity
            android:label="@string/app_name"
            android:name="NewText"
            android:theme="@android:style/Theme.Dialog"
            android:launchMode="singleTask"
            android:screenOrientation="user"&gt;
        &lt;/activity&gt;

        &lt;service android:enabled="true" android:name=".servicetest" /&gt;
</code></pre>
