1

I have an app with an intro screen, there will be two buttons in this screen (Ok and Cancel)

If the user clicks the cancel button the application will terminate, and if the user clicks the ok button ,the main screen appears, the main screen got a back button to go back to the intro screen.

Now, my problem is I have used

finish();

for the cancel button, and what I understood is that the 'finish()' will terminate the current running activity.

Once the application is started and if the user clicks the cancel button, the app terminates, but if the user goes to the main screen and comes back to the intro screen and then click cancel the intro screen will exit(Activity responsible for the intro screen).and the main screen appears back.

This forms a continuous loop since the previous Activity (activity opened just before the intro activity) will always appear even if the user clicks the cancel button...

Does anyone have an idea how to terminate more than one activity at a time?

Reno
  • 33,594
  • 11
  • 89
  • 102
rahul
  • 2,758
  • 5
  • 32
  • 53

1 Answers1

1

You can use setResult() function in your Intro Activity, and 'catch' it in Main Activity overriding OnActivityResult() function.

mat
  • 337
  • 1
  • 9