Take the 2-minute tour ×

My application has three activities say A -> B-> C.

Activity A is called from another activity through startActivityForResult(). Activity B and C are also called similarly. I have to call activity A from notifications bar also (if there is some specific notification).

Now, if currently I am in activity B or C, and I click on Notification bar, and call the activity A, the app goes to Activity A only and data entered through activites B or C do not persist.

I don't want such behavior. I want that if I click on Notification, it should redirect to current screen only. Can some one help. (I mentioned activity:launchMode as SingleTask).

share|improve this question

2 Answers 2

up vote 0 down vote accepted

You may be able to use a static variable to determine other data. I am not sure how much or what type of data you are looking to access from the other Activities, though.

Also writing to persistent storage may work, but again - the vagueness of what data you are storing and how makes it difficult to answer. Just write/read the persistent storage in the onResume and onSuspend methdod of each Activity (or create super Activity class and extend it for A, B and C.

share|improve this answer
That also does not worked for me. Sorry for getting so long time in response –  Gaurav Sep 13 '11 at 13:13
persistent storage doesn't work? –  CrackerJack9 Sep 13 '11 at 18:25
No that does not work, so we changed the design of our app. Any ways Thank you so much –  Gaurav Sep 14 '11 at 6:41

Using android:launchMode="singleTask" is probably the best approach, since it won't recreate the activity if it's already running. Just add it to the activity in your AndroidManifest.xml, and you should be all set.

        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />

Here's another question that might be useful: Android singleTask or singleInstance launch mode?

share|improve this answer
no it does not works. I tried alot but mentioning simply single task, is not workin –  Gaurav Jul 18 '11 at 14:00

Your Answer


