离开TabActivity并正常返回
我有一个问题,我有一个使用 TabActivities 的 ActivityGroup。在不同的活动之间切换一切都很顺利。然而,我有一些观点,我不想有标签。他们是完全不同的观点我不想成为活动小组的一部分。
目前,我只需在 ActivityGroup
的 startActivityFromChild
函数中执行常规 startActivity(intent)
即可离开活动组。
这是可行的,但是当我点击后退按钮时,尽管我返回到之前的 TabActivity,但 onCreate()
却被调用了两次。
如何正确地将 TabActivity
保留到常规 Activity
然后正确返回它?
I have an issue where I have an ActivityGroup using TabActivities. Everything works great switching between different activities. However, I have some views that I don't want to have tabs. They are completely different views I don't want to be part of the activity group.
Currently I'm leaving the activity group by just doing a regular startActivity(intent)
in the ActivityGroup
's startActivityFromChild
function.
This works, but when I hit the back button, though I return to the previous TabActivity, onCreate()
is called twice as a result.
How can I properly leave a TabActivity
to a regular Activity
then properly go back to it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定,但我敢打赌 onCreate 会被故意调用两次。也许一次是通过组,然后是通过实际的选项卡。这种行为实际上破坏了您的代码吗?
也许将您不想运行两次的代码移至单独的函数。然后设置一个标志来决定是否/何时运行它。
I don't know for sure, but I bet onCreate is being called twice intentionally. Perhaps once by the Group and then by the actual Tab. Is this behavior actually breaking your code?
Perhaps move to a separate function the code that you don't want to run twice. Then set a flag to decide if/when you want to run it.
固定的。该问题与 getLocalActivityManager().startActivity(newRecord.id, newRecord.intent); 有关在不同功能的活动组中被调用两次。
Fixed. The issue had to do with getLocalActivityManager().startActivity(newRecord.id, newRecord.intent); being called twice in the activity group in different functions.