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

后端 未结 8 1171
隐瞒了意图╮
隐瞒了意图╮ 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:45

    whenever a new ACTIVITY starts the previous activity's onPause will be defiantly called in any circumstances.

    actually there will be two circumstances:

    1- a part of previous activity is visible or the new activity is transparent: only onPause will be called.

    2- previous activity is completely covered by new activity: both onPause and onStop will be called

    ----Good to state some notes:

    NOTE 1: if a dialog starts on top of an activity NONE of onPause or onStop will be called.

    NOTE 2: if its an Activity whose theme is set to a dialog, the behavior will be just like a normal activity.

    NOTE 3: apparently a system dialog like permission dialog since marshmallow will cause onPause.

提交回复
热议问题