Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I finish all activities in current Android task?

Tags:

android

Is it possible to finish all activities in current Android task?

like image 265
Alexey Zakharov Avatar asked Oct 28 '11 10:10

Alexey Zakharov


People also ask

How do you finish multiple activities?

OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getApplicationContext(),ActivityB. class); intent. setFlags(Intent. FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); } });

How do you finish an activity?

On Clicking the back button from the New Activity, the finish() method is called and the activity destroys and returns to the home screen.


1 Answers

It was already asked here.
But basically there's no such function... Maybe you could keep a collection of all the activities and finish them yourself, but I doubt that's good practice.
Or if all your activities are in the same "stack" you could try the answer given by "user370305".

like image 86
Glenn85 Avatar answered Oct 23 '22 03:10

Glenn85