I am trying to get the Click event when clicking on currently selected tab of my TabActivity.
I tried below code but when i click on one tab the other tabs are not working/clicking properly.
setupTab(new TextView(this), "Map");
setupTab(new TextView(this), "Attacks");
setupTab(new TextView(this), "Profile");
setupTab(new TextView(this), "Headquater");
int numberOfTabs = tabHost.getTabWidget().getChildCount();
for(int t=0; t<numberOfTabs; t++){
getTabWidget().getChildAt(t).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if(tabHost.getCurrentTab() == 0){
Toast.makeText(TabContext, ""+"i m in on clickkkkk" ,1500).show();
getTabHost().setCurrentTab(0);
}
if(tabHost.getCurrentTab() == 1){
Toast.makeText(TabContext, ""+"i m in on clickkkkk....$#@$#$" ,1500).show();
getTabHost().setCurrentTab(1);
}
}
});
}