Code example for TabHost

Methods: addTabnewTabSpec

0
		Resources res = getResources(); // Resource object to get Drawables
		Intent intent;
 
		intent = new Intent().setClass(this, class1);
		spec = tabHost
				.newTabSpec(name)
				.setIndicator(name,
						res.getDrawable(icon))
				.setContent(intent);
		tabHost.addTab(spec);
 
	} 
 
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
 
		TabHost tabHost = getTabHost(); // The activity TabHost
		TabHost.TabSpec spec = null; // Resusable TabSpec for each tab
		 
		createTab(tabHost, spec, ListomateActivity.class, getString(R.string.today), R.drawable.ic_mailboxes_accounts);