What is Activity.finish() method doing exactly?

前端 未结 12 1934
别那么骄傲
别那么骄傲 2020-11-22 16:16

I\'m developing android applications for a while, and followed a lot of posts about activity life cycle, and application\'s life cycle.

I know Activity.finish

12条回答
  •  醉话见心
    2020-11-22 16:29

    My study shows that finish() method actually places some destruction operations in the queue, but the Activity is not destroyed immediately. The destruction is scheduled though.

    For example, if you place finish() in onActivityResult() callback, while onResume() has yet to run, then first onResume() will be executed, and only after that onStop() and onDestroy() are called.

    NOTE: onDestroy() may not be called at all, as stated on the documentation.

提交回复
热议问题