假设我的活动UI线程生成一个单独的线程在一些点。它是安全的新的线程来断火的意图展开新的活动?
Suppose my activity ui-thread spawns a separate thread at some point. Is it safe for that new thread to fire off an Intent for launching a new activity?
感谢
我可能是错的,但我觉得 startActivity()
内部在UI线程中执行。所以,是的,它应该是安全的。
I could be wrong, but I think startActivity()
internally executes in the UI thread. So yes, it should be safe.
如果你想成为100%的把握,调用你的 startActivity()
在活动的 runOnUiThread()
作为一个的Runnable
。
If you wanted to be 100% sure, invoke your startActivity()
in your activity's runOnUiThread()
as a Runnable
.