Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个Activity,它开始Thread做一些工作。如果用户按下返回按钮,或者 UI 线程调用finish()该线程会发生什么?
Activity
Thread
finish()
finish()在销毁活动之前,活动是否 会等待线程?
活动被销毁后线程是否完成了工作?
线程会做它的工作,但你不能对你的活动使用任何回调。
线程将在后台运行,直到线程被杀死。在您的情况下,线程不会被破坏。