Android scenario where ondestroy() is called without onpause() or onstop()

前端 未结 4 1213
误落风尘
误落风尘 2021-02-04 00:10

A few days back I was asked to write down scenarios where ondestroy() is called without onpause() or onstop() being called. Is it possible. If yes please explain.

4条回答
  •  一整个雨季
    2021-02-04 00:47

    This is possible when we call finish() directly in an activity. When finish() is called in an activity, onDestroy() is executed and it does following things:

    1. Dismiss any dialogs the activity was managing.
    2. Close any cursors the activity was managing.
    3. Close any open search dialog

提交回复
热议问题