Detailed examples of Android two startup modes
Detailed examples of Android two startup modes
Flag of intent_ ACTIVITY_ CLEAR_ Top and flag_ ACTIVITY_ REORDER_ TO_ FRONT
Two startup modes of activity: Flag_ ACTIVITY_ CLEAR_ Top and flag_ ACTIVITY_ REORDER_ TO_ FRONT
1. If four activities have been started: A, B, C and D. In D activity, we want to jump to B activity and want C to finish. We can add flags in intent in startactivity (intent), as shown below:
If you start B activity in this way, D and C will be finished. If the startup mode of your B activity is multiple, B activity will be finished, and then start a new activity B.
If you do not want to re create a new B activity, add the following to the above code:
In this way, B activity will create a new one. Instead, it will reuse the previous B activity and call the onnewintent () method of B activity.
2. If you have started four activities: A, B, C and D, and want to start another activity B in D activity, but do not become a, B, C, D and B, but want a and B, you can write the following code:
The above is the detailed explanation of the two methods of Android startup. If you have any questions, please leave a message or go to the community of this site for communication and discussion. Thank you for reading. I hope it can help you. Thank you for your support to this site!