method:setCurrentTabByTag ( String tag )
return type:void
content:ใช้กำหนด tab ปัจจุบัน ที่ต้องการให้ได้รับ Focus อยู่ โดยการกำหนดจาก tag ของ tab
example:public class AndroidBamboo extends Activity
{
public void onCreate( Bundle savedInstanceState )
{
super.onCreate ( savedInstanceState );
TabHost tab_host = new TabHost ( this );
tab_host.setup();
TabHost.TabSpec tab_spec_1 = tab_host.newTabSpec ( "tag_one" );
Button button = new Button ( this );
tab_spec_1.setContent ( button.getId ( ) );
tab_spec_1.setIndicator( "TestButton" );
tab_host.addTab ( tab_spec_1 );
TabHost.TabSpec tab_spec_2 = tab_host.newTabSpec ( "tag_two" );
TextView text_view = new TextView ( this );
tab_spec_2.setContent ( text_view.getId ( ) );
tab_spec_2.setIndicator( "TestTextView" );
tab_host.addTab ( tab_spec_2 );
tab_host.setCurrentTabByTag ( "tag_two" );
setContentView ( tab_host );
}
}