I'm already built custom tabs only with images and now i need to change this tabs images when user switch from Arabic\English button from another activity and
here is my code to get tabs from tab activity
mainTabs = ((TabActivityMy) getParent()).getTabHost();
mainTabs.getTabWidget().setDividerDrawable(null);
Intent intent = new Intent(this, c);
TabHost.TabSpec spec = mainTabs.newTabSpec(null);
View tabIndicator = LayoutInflater.from(this).inflate(R.layout.tab_indicator, ((TabActivityMy) getParent()).getTabHost().getTabWidget(), false);
ImageView icon = (ImageView) tabIndicator.findViewById(R.id.icon);
icon.setImageResource(drawableId);
spec.setIndicator(tabIndicator);
spec.setContent(intent);
mainTabs.addTab(spec);
when i do this app add new tabs i know this code is do that but i just need to change images for all current tabs
One way would be to remove all the views from tabhost first:
mainTabs = ((TabActivityMy) getParent()).getTabHost();
mainTabs.removeAllViews()
mainTabs.getTabWidget().setDividerDrawable(null);
Intent intent = new Intent(this, c);
TabHost.TabSpec spec = mainTabs.newTabSpec(null);
View tabIndicator = LayoutInflater.from(this).inflate(R.layout.tab_indicator, ((TabActivityMy) getParent()).getTabHost().getTabWidget(), false);
ImageView icon = (ImageView) tabIndicator.findViewById(R.id.icon);
icon.setImageResource(drawableId);
spec.setIndicator(tabIndicator);
spec.setContent(intent);
mainTabs.addTab(spec);
Try removing allviews from TabWidget:
mainTabs.getTabWidget().removeAllViews();
There is function:
mainTabs.clearAllTabs();
This should work in your case