Is it possible to finish all activities in current Android task?
OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getApplicationContext(),ActivityB. class); intent. setFlags(Intent. FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); } });
On Clicking the back button from the New Activity, the finish() method is called and the activity destroys and returns to the home screen.
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".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With