Android 中何时开始一项新活动以及何时重用旧活动
我对 Android 相当陌生,对于何时开始新活动有点困惑。情况是这样的。我有一个图书馆、网络视图和读者活动。
假设用户想去图书馆 ->网页视图->读者->图书馆
我应该在读者活动之后创建新的图书馆活动,还是应该尝试显示原始的图书馆活动?如果我选择后者,它会扰乱我的活动堆栈吗?
I'm fairly new to Android and I'm a little bit confused on when to start new activities. Here is the situation. I have a library, webview and reader activity.
Say the user wants to go library -> webview -> reader -> library
Should I be creating a new library activity after the reader activity or should I be trying to show the original library activity? If I do the latter will it mess up my activity stack?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在我看来,您混淆了“创建”新活动和切换活动的想法...您并没有真正动态地“创建”新活动,而是通过 Intent 从其他活动中调用它们。因此,如果您需要在读者之后去图书馆活动,只需开始改变活动的意图即可。您的应用程序一次只能有一项活动。
It seems to me you are confusing the ideas of "creating" a new activity and switching activities... You dont really "create" new activities dynamically, you call them from other activities via Intent's. So if you need to go to your library activity after your reader, just start an intent to change activities. your app only can only have one active activity at a time.