My application has three activities say A -> B-> C
.
Activity A is called from another activity through startActivityForResult()
. Acti
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.
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.
<activity
android:name=".MyActivity"
android:label="@string/app_name"
android:launchMode="singleTask"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Here's another question that might be useful: Android singleTask or singleInstance launch mode?