What is the difference between onPause() and onStop() of Android Activites?

后端 未结 8 1181
隐瞒了意图╮
隐瞒了意图╮ 2020-12-02 07:33

From android doc here http://developer.android.com/reference/android/app/Activity.html, it said \'Activity comes into foreground\' will call onPause(), and \'Ac

8条回答
  •  一生所求
    2020-12-02 07:52

    Practically, one should consider the difference between “onPause()” and “onPause() + onStop()”.

    Whenever some new activity occurs and occupies some partial space of the Screen. So your previously running activity is still visible to some extent. In this Case, the previously running activity is not pushed to Back Stack. So, here only onPause() method is called.

    On other hands, if some new Activity occurs and occupies the full screen so that your previously running activity is disappeared. In this Case, your previously running activity is moved to Back Stack. Here, onPause() + onStop() are called.

    To Summaries-

    onPause()- Screen is partially covered by other new activity. The Activity is not moved to Back Stack.

    onPause() + onStop()- Screen is fully covered by other new activity. The Activity is moved to Back Stack.

    Know more about- Back Stack.

提交回复
热议问题