Android History creating new Activity and not from Stack
For example, consider a task consisting of four activities: A, B, C, D. If D calls startActivity() with an Intent that resolves to the component of ac开发者_Python百科tivity B, then B will be brought to the front of the history stack, with this resulting order: A, C, D, B. But my requirement is the resulting order should be A, B, C, D, B. How to achieve this?
This answer will definitely help you. (Also possible dupe ?)
- You probably have to remove the
android:launchMode
attribute
I might be wrong, but by setting activity param android:launchMode="singleTask" you'll achieve what you need.
<activity android:name=".YourActivity" ... android:launchMode="singleTask"/>
With this variant only one instance of activity will ever be created, so be careful.
精彩评论