Methods Summary |
---|
private void | ensureTabHost()
if (mTabHost == null) {
this.setContentView(com.android.internal.R.layout.tab_content);
}
|
public android.widget.TabHost | getTabHost()Returns the {@link TabHost} the activity is using to host its tabs.
ensureTabHost();
return mTabHost;
|
public android.widget.TabWidget | getTabWidget()Returns the {@link TabWidget} the activity is using to draw the actual tabs.
return mTabHost.getTabWidget();
|
protected void | onChildTitleChanged(Activity childActivity, java.lang.CharSequence title)
// Dorky implementation until we can have multiple activities running.
if (getLocalActivityManager().getCurrentActivity() == childActivity) {
View tabView = mTabHost.getCurrentTabView();
if (tabView != null && tabView instanceof TextView) {
((TextView) tabView).setText(title);
}
}
|
public void | onContentChanged()Updates the screen state (current list and other views) when the
content changes.
super.onContentChanged();
mTabHost = (TabHost) findViewById(com.android.internal.R.id.tabhost);
if (mTabHost == null) {
throw new RuntimeException(
"Your content must have a TabHost whose id attribute is " +
"'android.R.id.tabhost'");
}
mTabHost.setup(getLocalActivityManager());
|
protected void | onPostCreate(android.os.Bundle icicle)
super.onPostCreate(icicle);
ensureTabHost();
if (mTabHost.getCurrentTab() == -1) {
mTabHost.setCurrentTab(0);
}
|
protected void | onRestoreInstanceState(android.os.Bundle state)
super.onRestoreInstanceState(state);
ensureTabHost();
String cur = state.getString("currentTab");
if (cur != null) {
mTabHost.setCurrentTabByTag(cur);
}
if (mTabHost.getCurrentTab() < 0) {
if (mDefaultTab != null) {
mTabHost.setCurrentTabByTag(mDefaultTab);
} else if (mDefaultTabIndex >= 0) {
mTabHost.setCurrentTab(mDefaultTabIndex);
}
}
|
protected void | onSaveInstanceState(android.os.Bundle outState)
super.onSaveInstanceState(outState);
String currentTabTag = mTabHost.getCurrentTabTag();
if (currentTabTag != null) {
outState.putString("currentTab", currentTabTag);
}
|
public void | setDefaultTab(java.lang.String tag)Sets the default tab that is the first tab highlighted.
mDefaultTab = tag;
mDefaultTabIndex = -1;
|
public void | setDefaultTab(int index)Sets the default tab that is the first tab highlighted.
mDefaultTab = null;
mDefaultTabIndex = index;
|