Search code examples
androidandroid-activitydata-transfer

Is it possible to call one activity from two different activities in android


So, I have 2 activities, the first one(lets call this A) passes data to an activity with a list, lets call this B. B then uses the data from A and makes a list out of it.A service S is then called by B. The service then calls another activity lets say C, which in turn starts B. Should B still work with all the data?BTW all activities are ActionBarActivities.


Solution

  • In the general case, each time an activity in invoked using startActivity, a new instance is create.

    This behavior can be modified by the use of the launchMode. singleTask will always be the same instance, but your activity must be at the root of the task

    An existing activity can also be called back to the front of the stack using the flag FLAG_ACTIVITY_REORDER_TO_FRONT. It is unclear in the documentation how the new data is passed, or whether the previous data in the activity is kept.