Skip to content Skip to sidebar Skip to footer

Android Activity Management

I have one question in mind for activity management. Suppose I have 4 activities say for example A1,A2,A3,A4. Now A1 have one button which start activity A2. A2 have 2 buttons whic

Solution 1:

You can get this behaviour by including the FLAG_ACTIVITY_REORDER_TO_FRONT in your Intent's flags and then just calling startActivity(intent) like you normally would.

Solution 2:

Intent intent = new Intent();

intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);

startActivity(intent);

Solution 3:

You can search "android:lunchMode" by Google. Then you will get the anwser.

Solution 4:

Whenever the button is clicked in any activity, it creates the new instance of the activity irrespective of the fact the activity is already on the activity stack. Since new Intent is fired every time, it opens new activity. When we press back button then only it goes to the already opened activity from the stack.

Post a Comment for "Android Activity Management"