如何在Android电子标签之间切换?

问题描述:

我如何从所在的选项卡主机中的活动之一中的多个标签之间切换?我需要明天来完成该项目。我的项目涉及展示3个标签具有不同的内容。所以,请帮助任何人。

How do I switch between tabs from within one of the activities that is located inside the tab host? I need to complete the project by tomorrow. My project involves showing 3 tabs with varying content. So please help anyone.

如果您添加标签为活动,你可以使用这个code选项卡子活动在

If you added the tabs as activities you can use this code inside a tab child activity

TabActivity main = (TabActivity) getParent(); // get the main 'TabActivity' from a Child (tab)
TabHost tabHost = main.getTabHost(); // get a handle to the TabHost
tabHost.setCurrentTab(<index>)