从 TabActivity 或 TabHost 获取特定 Activity
如何从 TabActivity 或 TabHost 获取特定的 Activity?
我尝试了 TabHost.getChildAt()
,但 View
实例无法转换为 Activity
实例。
或者如何获取在后台运行的 Activity?
How can I get a specific Activity from TabActivity or TabHost?
I tried TabHost.getChildAt()
, but a View
instance can't be casted to an Activity
instance.
Or how do you get an Activity which is running in background?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我找不到
TabActivity.getLocalActivityManager().getActivity()
。对我来说,它使用
TabActivity.getLocalActivityManager().getCurrentActivity()
工作。I couldn't find
TabActivity.getLocalActivityManager().getActivity()
.For me it worked using
TabActivity.getLocalActivityManager().getCurrentActivity()
.找到答案:只需使用
TabActivity.getLocalActivityManager().getActivity()
found the answer: just use
TabActivity.getLocalActivityManager().getActivity()
我知道这不是您想要的,但我强烈建议不要使用 TabActivity。在我参与的所有项目中,我们最终都将其拉出并仅使用看起来像选项卡的按钮。
我还认为它在 3.0 中已被弃用,当然还有冰淇淋。他们推动操作栏。我会寻找可用的操作栏库之一。
I know this isn't what you're looking for, but I HIGHLY recommend not using TabActivity. In all the projects I've worked on, we wound up yanking it out and just using buttons that look like tabs.
I also think its deprecated in 3.0, and certainly Ice cream. They push the action bar. I'd look for one of the available action bar libraries.