you mean that you want to create a custom tab for your application. Now you have two classes - homemyclass.java and myclass.java. First you declare the current two lines in homemyclass.java
private Intent mytab;
private static final String TAB_MYCLASS = "myclass";
then you write the current line to the onCreate () function of homemyclass.java
mytab = new Intent(this, myclass.class);
addTab(TAB_MYCLASS, getString(R.string."label for tab"), R.drawable."icon for tab display when
tab is selected", R.drawable."icon for tab display when tab is not selected", mytab);
just add addTab () to homemyclass.java
private void addTab(String tag, String label, int icon, int ficon, Intent content) {
TabHost tabHost = getTabHost();
TabSpec tabspecDialer = tabHost.newTabSpec(tag).setContent(content);
tabspecDialer.setIndicator(label, getResources().getDrawable(icon));
tabHost.addTab(tabspecDialer);
}
you also need to change androidManifest.xml to homemyclass.java and myclass.java
source
share