Tuesday, September 20, 2011

How to Change Tab Name from Activity in Android

Tabs in the Android work with TabWidgets.
Contained in the tabwidget are relative layouts for each of your tabs which each contain an imageview and a textview.
Tab index will start from 0 and to access the Tab Contents use the following steps.
For Example. if you want to access title of tab

the above statement will provide the view (TextView) at this position.

change the text of Tab

TextView v = ((TextView)mTabHost.getTabWidget().getChildAt(0).findViewById(;

v.setText("My New Title");

Your text of tab is changed.

No comments: