Skip to content Skip to sidebar Skip to footer

Errors When Using A Fragmenttabhost Inside A Fragment

Im' trying to add a FragmentTabHost inside a Fragment(which is the content of another tab widget. I used the following xml:

Solution 1:

You haven't read the documentation for the FragmentTabHost class which clearly states that FragmentTabHost is a Special TabHost that allows the use of Fragment objects for its tab content.. So you can't setup the tabs to be activities and it would not make sense anyway as you're trying to have activities in fragments(it should be the other way around).

So modify your code to use fragments as the tabs content or use a normal TabHost in an Activity to continue using those activities as tabs(this option is deprecated and you should really go with the first option).

Is there a proper way to put tab host inside a Fragment?

In the documentation I've linked you have an example, if I'm not mistaken there are some examples in the support library's samples.

Post a Comment for "Errors When Using A Fragmenttabhost Inside A Fragment"