I have a problem with Android and the transitions with activities. What I want to have is the following:
- MainActivity calls Activity B.
- Activity B calls MainActivity (for example, via Back Button, same instance)
- MainActivity calls the same instance of Activity B. (Same instance is important because Activity B takes a long time to start)
- Activity B calls MainActivity (for example, via Back Button, same instance)
- MainActivity Back Button is pressed and app is terminated.
What I tried:
Main Activity:
android: launch mode = "single task"
Start Activity B:
Intent intent = new Intent (this, B.class);
this.startActivity (intent);
Activity B:
android: launch mode = "SingleInstance"
Start MainActivity:
Intent callerIntent = new Intent (this, MainActivity.class);
CallerIntent.addFlags (Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);
start activity (caller intent);
Unfortunately point 5 does not work.
I have searched for a long time, but unfortunately found nothing or searched for the bottle words. I hope somebody can help me.
I also have a small demo app on which you can test the behavior: AndroidStudioZipFile (30 days available)