Search code examples
androidandroid-activityactivity-lifecycle

when onStop is actually called


In my simple android app I have 2 activities. In first activity(Main activity) I have override the ON STOP method. But when I go do the second activity on stop method of main_Activity is called. Why this happens? According to my understanding I should call on Pause rather then on Stop.


Solution

  • It calls both. onPause() will be called before onStop(), if onResume() was called. Rougly speaking, onPause() is called when activity is partially hidden, and onStop() when it is fully hidden.

    Read up on http://developer.android.com/training/basics/activity-lifecycle/index.html to understand the Activity lifecycle.