I don't know much about this, but a quick look at the docs and I'm guessing 
this is your problem...

   FLAG_ACTIVITY_NEW_TASK = If set, this activity will become the start of 
   a new task on this history stack. 

You've created a new activity which you are indeed closing, to reveal your 
old activity that's still on the stack. I don't know what the correct one 
to use instead, but this looks promising...

FLAG_ACTIVITY_SINGLE_TOP<http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_SINGLE_TOP>
 = If set, the activity will not be launched if it is already running at 
the top of the history stack.


Check the above flags here...

http://developer.android.com/reference/android/content/Intent.html 

Good luck

On Tuesday, March 27, 2012 12:35:21 AM UTC-7, vani wrote:
>
>
> Hi friends,
>
> In my MainActivity (extends TabActivity)  has 5 tabs. suppose i am in 2nd 
> tab and i receive a  push notification,without closing the app i open the 
> notification it switches to  3rd tab,when i press back, i show a dialog 
> saying 'Are you sure you want to exit' when i say YES it goes to the third 
> tab. but I want to exit the app.
> How to acheive this.In the manifest I have declared as 
> <activity android:name=".MainActivity"
>             android:launchMode="singleTask" 
>             android:alwaysRetainTaskState="true" 
>             android:screenOrientation="portrait" 
> android:theme="@style/MyTheme"
>             android:windowSoftInputMode="stateAlwaysHidden" />
>
> Below is the onReceive method of IntentReceiver
>
>
>     @Override
>     public void onReceive(Context arg0, Intent aIntent) {
>         String action = aIntent.getAction();
>         if (action.equals(PushManager.ACTION_NOTIFICATION_OPENED)) {
>             // user opened the notification so we launch the application
>
>             // This intent is what will be used to launch the activity in 
> our
>             // application
>             Intent lLaunch = new Intent(Intent.ACTION_MAIN);
>
>             // Main.class can be substituted any activity in your android
>             // project that you wish
>             // to be launched when the user selects the notification from 
> the
>             // Notifications drop down
>             lLaunch.setClass(UAirship.shared().getApplicationContext(),
>                     MainActivity.class);
>             lLaunch.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
>
>             
> UAirship.shared().getApplicationContext().startActivity(lLaunch);
>
>         } else if (action.equals(PushManager.ACTION_PUSH_RECEIVED)) {
>             // push notification received, perhaps store it in a db
>
>         }
>
>     }
>
> Please tell me what I am supposed to do and where  I am going wrong.
>
>
> -- 
> Regards,
> Vani Reddy
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to