Activity A is my mainscreen where the users can navigate to B,C,D. So in normal circumstances, User would create Activity B from A and the stack would look like A->B. Pressing back from B takes you back to A.
I have another intent setup for activity B (for NFC), so that B could get directly launched under special circumstances. In this case, pressing back would just take me back to the home screen. I need the back button to take the user back to the main activity (A).
How can I accomplish this by directly manipulating the stack? If this isn’t possible, what is the best alternative?
Use extras in your intent from activity A to pass the “name” of the caller, then just check these intents when leaving the activity and either make a new Intent for the main activity or just let it stop accordingly.
In Activity A, when calling B:
In Activity B:
When stopping activity B, if the caller isn’t ActivityA then start it.