Code example for TabHost

Methods: getTabWidgetsetCurrentTab

		// Unfortunately when TabHost changes the current tab, it kindly 
		// also takes care of putting focus on it when not in touch mode. 
		// The jerk. 
		// This hack tries to prevent this from pulling focus out of our 
		// ViewPager. 
		TabWidget widget = mTabHost.getTabWidget();
		int oldFocusability = widget.getDescendantFocusability();
		if (mHorizontalScrollV != null) {
			final int width = widget.getMeasuredWidth();
//			final float oneTabWidth = ((float)width)/mTabs.size(); 
			float scrollOffset = (float)position * ((float)width - (float)mScreenWidth)/((float)mTabs.size() - 1.0F);
			mHorizontalScrollV.scrollTo((int)scrollOffset, 0);
	public void onTabChanged(String tabId) {
Connect your IDE to all the code out there  Get Codota for Java