简体   繁体   English

android-如何从另一个选项卡重新启动选项卡

[英]android - How to restart the tab from another tab

My application have two tabs: tab1 and tab2 . 我的应用程序有两个选项卡: tab1tab2 Initially tab1 is activated. 最初, tab1被激活。 In this tab we have chance to navigate to child activities (In the sense tab1 have initial activity (A1) that consists of one button if you click on that then it will redirects to Activity2 ..). 在此选项卡中,我们有机会导航到子活动(从某种意义上说, tab1包含由一个按钮组成的初始活动(A1),如果您单击该按钮,则它将重定向到Activity2 ..)。

Now to you tap on the tab2 and it have one button if you click on that then I want to restart the tab1 . 现在,您点击tab2 ,如果单击该按钮,它有一个按钮,那么我想重新启动tab1 It means it shows the tab1 with initial activity (A1). 这意味着它将显示带有初始活动(A1)的tab1 How to implement this. 如何实现这一点。 I tried but I am not getting. 我尝试过,但没有得到。

Code: 码:

//This will just activate the tab1. it's not reset

CustomTabActivity.mTabHost.setCurrentTab(0)

onClickListener在TAB2按钮添加以下代码

tabHost.setCurrentTabByTag(String name of Tab1));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM