Special TabHost that allows the use of Fragment objects for its tab content. When placing this in a view hierarchy, after inflating the hierarchy you must call setup(Context, FragmentManager, int) to complete the initialization of the tab host.
Questions tagged [fragment-tab-host]
292 questions
102
votes
16 answers
IllegalStateException: Fragment already added in the tabhost fragment
FATAL EXCEPTION: main
Process: com.example.loan, PID: 24169
java.lang.IllegalStateException: Fragment already added: FormFragment{428f10c8 #1 id=0x7f050055 form}
at…

user782104
- 13,233
- 55
- 172
- 312
38
votes
1 answer
Dynamically changing the fragments inside a fragment tab host?
I have one main activity which is fragment activity here I am setting two tabs with two fragments A and B in the B fragment I have one button when the user click on the button I want to change fragment B to fragment C. But the tabs above are…

kalyan pvs
- 14,486
- 4
- 41
- 59
23
votes
3 answers
Is it possible to manually call onCreateView in a Fragment?
Is it possible to manually call the method onCreateView in a Fragment or, if not, is there some way I can simulate this invocation?
I have a FragmentActivity with tabHost. Each tab contains a Fragment and I want to refresh the Fragment's view when I…

Symon_9851
- 375
- 1
- 3
- 9
19
votes
3 answers
FragmentTabHost not creating view inside Fragment in android
I am having an issue getting the view to change on a tabhost - when I select a tab the content stays blank.
From what I can tell, onCreateView is not being called on the child Fragments. onMenuCreate runs fine because the menu changes like it is…

shaneburgess
- 15,702
- 15
- 47
- 66
19
votes
1 answer
Tutorial to implement the use of TabHost in Android 2.2 + ViewPager and Fragments
A short tutorial for people like me who had some trouble finding a way to implement TabHost and ViewPager, including page swiping with fingers and tab click to change pages. The shown solution is compatible with Android versions 2.2+.
It includes…

ᗩИᎠЯƎᗩ
- 2,122
- 5
- 29
- 41
13
votes
4 answers
How to create an Android Tabbed Dialog containing fragments?
Can anyone point me to an example or show me how to create a simple Tabbed Dialog in Android where the contents of each tab are Fragments? All the examples/tutorials I have found are about Fragments and Tabs, but nothing specific to…

Paul Drummond
- 6,043
- 6
- 30
- 38
12
votes
1 answer
IllegalStateException on FragmentManager
My app keeps to report this issue on many Android platforms (4.1, 4.0.4, 2.3.6...).
But I could not reproduce this issue on my phone.
I have searched for this issue by Google, but the stack trace seems not the same as my.
Does someone know how the…

user2581991
- 121
- 1
- 4
9
votes
4 answers
Change text color and selector in TabWidget
I've a TabWidget, independently of the ÀctionBar, in aFragmentTabHost`.
I want to customize the look and feel of the TabWidget but I don't get it. My intention is to change the text color and the selector color, as you can see in the image I can…

Mun0n
- 4,438
- 4
- 28
- 46
9
votes
4 answers
Fragmenttabhost performance is slow?
I have use the v4 support lib for FragmentTabHost
The requirement is that when I am switching tab one to another & another one, that is calling
onCreateView() & onActivityCreated() every time.
That's why my code performance is slow.
So, any other…

Saunik Singh
- 996
- 1
- 9
- 19
7
votes
4 answers
How to maintain fragment's state in the application
How to maintain fragment's state when it is shown within FragmentTabHost?
Thanks to this tutorial, I'm able to implement FragmentTabHost in my application.
My intention is to create an app whose main activity contains some tabs (which sticks on the…

reiley
- 3,759
- 12
- 58
- 114
7
votes
2 answers
Replace one fragment to another fragment in the TabHost
I am creating a five tabs that contains one fragment each.
I am using ListView in the first tab and in the ListView OnItemClickListener I want to replace from the first Tab Fragment to second tab Fragment.
How can I do that by using Fragment and…

It's me
- 1,065
- 6
- 15
- 30
7
votes
2 answers
Tabbed dialog with fragments in widget
I am working on widget, where for widget settings i am looking to provide a dialog for with tab fragment, the problem is dialog do not have action bar tabs, i have tried various lay out patterns, but none of them seems to work.
In the manifest,…

Akhil Jain
- 13,872
- 15
- 57
- 93
6
votes
2 answers
How to get current selected Fragment in FragmentTabHost
There are some questions related to this same issue. For example, this one. But it doesn't work.
Let me show what I did in my code.
activity_main.xml

Bagusflyer
- 12,675
- 21
- 96
- 179
6
votes
2 answers
Fragment tab host error:Exception raised during rendering: No tab known for tag null
I have been using the fragment tab host for some time and it was working fine.
Suddenly i am getting this layout compilation error.
Exception raised during rendering: No tab known for tag…

OnDWay
- 119
- 4
- 11
6
votes
2 answers
Android : passing parameters to a tab
In my Android app, I use the following code to create tabs :
mTabHost = (FragmentTabHost)findViewById(android.R.id.tabhost);
mTabHost.setup(this, getSupportFragmentManager(),…

Arnaud
- 7,259
- 10
- 50
- 71