Can someone please explain how startActivity(intent) and startActivityForResult(intent) are Asynchronous?

后端 未结 2 473
太阳男子
太阳男子 2021-02-12 13:38

If an Asynchronous thread is a thread that operates separately to the main thread and doesn\'t interfere with the main thread...

Does a new Activity not occ

2条回答
  •  一向
    一向 (楼主)
    2021-02-12 14:14

    startActivity(intent) and startActivityForResult(intent) are asynchronous in the sense that these methods return immediately without starting an Activity. Actually, they schedule an Activity to start only after the lifecycle events of the current Activity is finished.

    The takeaway is, if you have something, that takes some time to finish, in the onPause() method of the first activity , the new Activity will be slow to start.

提交回复
热议问题