I am writing a simple Android application, and I would like to better control the navigation / relationships between actions. I donโt want my actions to act like android actions ... I donโt want them to work out in the Task. I want one Activity (let it MainActivity ) be the landing point and always be at the bottom of the stack, and I want only one instance of my second action (call it SecondActivity ) to be higher than it on the stack ... it would be nice to reuse it . I thought I could achieve this behavior by making MainActivity the "primary" Activity and declaring them as launchMode=singleTop . This does not work at all. I provide navigation between them using the menu, so when I go back and forth, a bunch of times back and forth from the application, I look at the entire stack.
What is the best way to have excellent control over the Task Activity stack? I want MainActivity to always return from the application and SecondActivity to always return to the same instance of MainActivity. Also, I would like to get singleTop so that I use onNewIntent instead of creating and destroying each time. Using the manifest as well as the intent flag just doesn't work. Any ideas?
source share