Code example for TabHost

Methods: setCurrentTab

0
	 
    protected Handler mHandler = new Handler() {
        @Override public void handleMessage(Message msg) { 
            switch (msg.what) { 
            	case SWITCH_TAB: 
                    tabHost.setCurrentTab(msg.arg1);            		 
            		break; 
            } 
        } 
    }; 
 
    public class TabChangeReceiver extends android.content.BroadcastReceiver{
		@Override 
		public void onReceive(Context context, Intent intent) {
			int intExtra = intent.getIntExtra("tab", 0);
			Log.i(TabChangeReceiver.class.getSimpleName(), "Recieved broadcast with extra=[" + intExtra + "]");
			mHandler.sendMessage(mHandler.obtainMessage(SWITCH_TAB, intExtra, 0));
		} 
	} 
 
	private OnClickListener goToTab1() {