TabHost is deprecated in android api level 11 onwards.
Try using ActionBar.
For more details, see this.
UPDATE:
Please see this, for using setDrawable
in ICS
.
UPDATE:
If you want to make use of tabs on all android versions, you can use the following code:
if (android.os.Build.VERSION.SDK_INT >= 11) {
// setup action bar for tabs
ActionBar actionBar = getActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.setDisplayShowTitleEnabled(false);
Tab tab = actionBar.newTab()
.setText(R.string.artist)
.setTabListener(new TabListener<ArtistFragment>(
this, "artist", ArtistFragment.class));
actionBar.addTab(tab);
tab = actionBar.newTab()
.setText(R.string.album)
.setTabListener(new TabListener<AlbumFragment>(
this, "album", AlbumFragment.class));
actionBar.addTab(tab);
} else {
// put your TabHost code here...
}
This should be placed in your onCreate()
method.