How to interact with several actions interacting with each other?

I have an application with 4 or 5 actions! Let them say A, B, C, D and E.

It is more or less possible to move from any activity to any other activity!

Suppose the user goes A → B → E → D.

Now he wants to open B (again). Now I want my application to recognize that there is already one active B somewhere in the activity stack and reactivate it (or at least complete the old B and create a new one).

I do not want to complete all the steps when creating new ones, because most likely the user often uses the stand.

Possible solutions: create your own action stack and process it in bundles or use some static structures.

But there should be a much simpler / nicer way, is there

Thank you for your help!

+3
source share
1 answer

You can use the value singleInstanceor singleTaskin the run mode tag in the manifest.

android:launchMode=["multiple" | "singleTop" |"singleTask" | "singleInstance"]

In line with Android developer basics

Modes singleTaskand singleInstancealso differ from each other only in one respect:

Activity

A singleTaskallows other actions to be part of his task. He always lies at the heart of his task, but other actions (necessarily standardand singleTop) can be included in this task .

Activity, on the other hand

A singleInstance . . , - FLAG_ACTIVITY_NEW_TASK .

+3

All Articles