-4

Hi guys

I wanted to ask : I have a first activity that opens the second activity in the Activity menu. I press exit in Activity 2 and would like you to also close the Activity 1. How to do this?

Divya Motiwala
  • 1,659
  • 1
  • 16
  • 24

1 Answers1

2

When you start an Activity B from Activity A, use startActivityForResult(...). When you want to close the entire app, you can do something like this:

    setResult(RESULT_CLOSE_ALL);
    finish();

You can check How to kill an application with all its activities? for detailed description

Community
  • 1
  • 1
Divya Motiwala
  • 1,659
  • 1
  • 16
  • 24