I have the following in a class for creating a FragmentTabHost
:
public class TabsActivity extends FragmentActivity {
private FragmentTabHost mTabHos
Without being able to see your xml file (R.layout.tabs) I'd say something is not set up quite right.
Instead of:
TabHost.TabSpec exploreSpec = mTabHost.newTabSpec("explore").setIndicator("Explore", getResources().getDrawable(R.drawable.exploreicon));
mTabHost.addTab(exploreSpec);
Try:
mTabHost.addTab(mTabHost.newTabSpec("explore").setIndicator("Explore", getResources().getDrawable(R.drawable.exploreicon)), TheAssociatedFragmentTab.class, null);
R.layout.tabs.xml
Beyond that you will just need an ExplorerFragment class (extends fragment) which Overrides onCreateView and inflates the layout for your explorer tab like so..
ExplorerFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
super.onCreateView(inflater, container, savedInstanceState);
return inflater.inflate(R.layout.explorer_fragment, container, false);
}
I didn't try to incorporate an image on my tabs, but this code works for me. Let me know if that helps.