开发者

how to call an activity of a task from an activity of another task

开发者 https://www.devze.com 2023-03-18 12:26 出处:网络
If, there is an activity task with activities A1 -> A2 and another activity task with activities B1 -> B2

If, there is an activity task with activities

A1 -> A2

and another activity task with activities

B1 -> B2

The requirement is, From B2 I need to call A2, but no new instance of A2 开发者_JAVA百科must be created, it should be loaded from the stack (A2 which is in top of the first task)

Now when I press back button from A2 I need to get A1?

How to implement this?


Have you read Tasks and Back Stack?

There is an option for activity:
"singleTask"
The system creates a new task and instantiates the activity at the root of the new task. However, if an instance of the activity already exists in a separate task, the system routes the intent to the existing instance through a call to its onNewIntent() method, rather than creating a new instance. Only one instance of the activity can exist at a time.

0

精彩评论

暂无评论...
验证码 换一张
取 消