In one of my applications I have used a tab bar with the help of {{tabactivity}} and {{activitygroup}} for displaying the tab bar in every screen.
I want to detect a second click on the already selected tab and implement a feature similar to the iPhone UITabbar. On a second click it will come to the initial activity.
public class Tabmanagement extends TabActivity{
public static Button back;
public static TextView text;
public static Button next;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.tabmanagement);
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
Resources res = getResources();
TabHost tabHost = getTabHost();
TabHost.TabSpec spec;
Intent intent;
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.windowstitle);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
back=(Button)findViewById(R.id.Btn_Back);
text = (TextView) findViewById(R.id.Text_Title);
next=(Button)findViewById(R.id.Btn_Search);
spec = tabHost .newTabSpec("tab1")
.setIndicator("Topics",res.getDrawable(R.drawable.topics))
.setContent(new Intent(this,FirstGroup.class)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
tabHost.addTab(spec);
spec = tabHost .newTabSpec("tab2")
.setIndicator("Posts",res.getDrawable(R.drawable.post))
.setContent(new Intent(this,SecondGroup.class)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
tabHost.addTab(spec);
intent = new Intent().setClass(this, ThirdGroup.class);
spec = tabHost .newTabSpec("tab3")
.setIndicator("Response",res.getDrawable(R.drawable.response))
.setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, FourthGroup.class);
spec = tabHost .newTabSpec("tab4")
.setIndicator("Settings",res.getDrawable(R.drawable.settings))
.setContent(intent);
tabHost.addTab(spec);
tabHost.setCurrentTab(0);
}
}