onStop() not getting called when I press the back button

前端 未结 3 1644
灰色年华
灰色年华 2021-02-15 23:14

Is this normal.

The docs say

\"The onStart() and onStop() methods can be called multiple times, as the activity alternates between being visible and hidden to th

3条回答
  •  眼角桃花
    2021-02-16 00:01

    You want onPause(), not onStop(). onStop is called just before the activity is destoryed, when the system is low on memory. onPause is called whenever the user navigates away from your activity. See diagram at http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle.

提交回复
热议问题