Search code examples
javaandroidandroid-activityrestartdestroy

What method call from Back button pressed of Android Activity?


I read along the documentation in this page. And obtaining clear picture of one activity starts in android. Just like this screenshot below:

enter image description here

Here is my case.

Activity -A called Intent to start Activity B-. And then from Activity -B the user click Back button. So then it returned to Activity -A.

my question is .... since now we're in that Activity -A.

Does onPaused() method called back or onResumed() method that is called now?


Solution

  • When ActivityB takes the foreground, Activity A is put into the stopped state (onPause and onStop will be called). When ActivityA comes back, it will get onStart, followed by onResume.