当 TabWidget 使用 intents 为每个选项卡指定目标 Activity 时,除了默认操作之外,Activity Stack 上的那些 Activity 是否有任何特殊处理?
例如,如果我的应用程序有选项卡 A、B 和 C,我按此顺序单击它们——A、B、A、C、A、B——Activity 堆栈将如何变化?
我对默认操作的理解,如果每次都按 Intent 调用 startActivity(),Stack 会继续加载 Activity 的新实例:A、AB、ABA、ABAC、ABACA、ABACAB
虽然很难相信这就是它的工作原理……这似乎是一种资源浪费,而且可能是无穷无尽的。谁能告诉我这实际上是如何工作的?
最佳答案
For Instance, if my app has tabs A, B, and C, and I click them in this order––A, B, A, C, A, B––how will the Activity stack change?
TabWidget
的内部 Activity 不会进入堆栈。
My understanding of the default operation, if startActivity() is called each time on the intent, would have the Stack keep loading up new instances of the activities: A, AB, ABA, ABAC, ABACA, ABACAB
TabWidget
不会在每次点击选项卡时创建新 Activity 。
关于android - TabWidget Activity 处理 - 它是否每次都创建一个新 Activity ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2719862/