I find the answer myself. Simply calling this method on the fragmentTabHost object works:
((TextView((RelativeLayout)getTabWidget().getChildAt(tabIndex)).getChildAt(textIndex)).setText("NewTabText");
質問
After setting up my FragmentTabHost with addTab(mTabHost.newTabSpec(....)) I don't know ho to get the reference to the TabSpec.
All I need is to change the name of the tab (tabSpec.setIndicator("new name")) that I initially set with the mTabHost.newTabSpec method.
Thanks!
解決
I find the answer myself. Simply calling this method on the fragmentTabHost object works:
((TextView((RelativeLayout)getTabWidget().getChildAt(tabIndex)).getChildAt(textIndex)).setText("NewTabText");
他のヒント
I think this is a more straight way to get the thing done:
((TextView) mTabHost.getCurrentTabView().findViewById(android.R.id.title))
.setText(yourTitle);
Whoever wrote this should have defined a setTabText(int position, String text)
method, otherwise who would know they have a text view id'ed android.R.id.title
? Or if they already had, please enlighten me.