Send data to action using FLAG_ACTIVITY_REORDER_TO_FRONT

I have some actions: A, B, C, D ... With each action, it has buttons for launching others. So: A can start B, C, D; B can fire A, C, D; ...

I do not want to create multiple instances of these actions, so when I start the action, I use the FLAG_ACTIVITY_REORDER_TO_FRONT flag.

Every time an action is launched, I need to transfer data and update it. But with the FLAG_ACTIVITY_REORDER_TO_FRONT flag, the oncreate function is not called.

My question is: how to transfer data between actions when using the FLAG_ACTIVITY_REORDER_TO_FRONT flag.

+4
source share
1 answer

You should receive this request in A. onNewIntent(Intent data) if activity is not recreated. However, your logic should consider both cases: recreated and not. Therefore, you should have some way of customization in which you update the user interface based on the intentions received.

+5
source

Source: https://habr.com/ru/post/1494240/


All Articles