Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to kill sub activities and bring activity to top of stack

I have activity A that starts activity B which starts activity C:

A -> B -> C

When a user clicks on a button in activity C, I want to bring A to the top of the stack and take B & C completely out of the stack. Is there a way to do this?

like image 854
slim Avatar asked Aug 04 '10 18:08

slim


People also ask

How do you kill an activity?

Explanation. finish() − It is used to close the activity. finish(int requestCode) − It is used to close the activity with requestCode.

How do I delete a Backstack?

Use finishAffinity() to clear all backstack with existing one. Suppose, Activities A, B and C are in stack, and finishAffinity(); is called in Activity C, - Activity B will be finished / removing from stack. - Activity A will be finished / removing from stack. - Activity C will finished / removing from stack.

What is activity in Android stackoverflow?

Activity: represents the presentation layer of an Android application, e.g. a screen which the user sees. An Android application can have several activities and it can be switched between them during runtime of the application.


1 Answers

You can use the FLAG_ACTIVITY_CLEAR_TOP flag on the intent to restart activity A.

like image 56
Cheryl Simon Avatar answered Oct 06 '22 01:10

Cheryl Simon