0

I am developing an application in which I want to set an activity on hold and intent to next activity. I want to resume main activity when I will return to this activity.

Michaël
  • 3,679
  • 7
  • 39
  • 64
jatyan
  • 41
  • 1
  • 3

1 Answers1

2

When starting a new activity, it will be shown above the current activity. When an activity is not on top anymore, it will be paused. When pressing the back button, it will be resumed again.

Here the documentation on the activity class, including its lifecycle.

This scheme might make it clear:

enter image description here

The onPause() and onResume() methods can be used for pausing/resuming or saving/restoring state of certain tasks in your activity.

If you are starting a activity that has to return a value to the current activity, you could use startActivityForResult(). Android SDK explanation about this here, SO question answer+example here.

Community
  • 1
  • 1
NickL
  • 4,258
  • 2
  • 21
  • 38