需要从一种 Activity 过渡到另一种 Activity 。需要在主线程上执行的startActivity(intent);
可以是工作线程吗?我会选择主线程的概念,因为存在与GUI相关的操作。你怎么认为?
最佳答案
是的,应该这样做,但正如其他人所述,则不需要这样做。
基本上,就Context
而言,“where”应该将新的Activity放在其堆栈中或其他堆栈的下方/上方。
From documentation:
Launch a new activity. You will not receive any information about when the activity exits.
Note that if this method is being called from outside of an Activity Context, then the Intent must include the FLAG_ACTIVITY_NEW_TASK launch flag. This is because, without being started from an existing Activity, there is no existing task in which to place the new activity and thus it needs to be placed in its own separate task.
关于android - startActivity应该在主线程上执行吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39711087/