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
3
votes
2 answers
How to restore child fragments in TabHost/ViewPager parent fragment
The problem is highlighted below, the first part describes what is working so far.
I use multiple fragments with one activity. The upper part of the figure shows a single fragment, e.g. a list with some random content. If I click somewhere it will…

Michael
- 3,982
- 4
- 30
- 46
3
votes
1 answer
How to add button to FragmentTabHost
I need to add a button to FragmentTabHost. How to build something like this?
FragmentTabHost tabHost = (FragmentTabHost) view.findViewById(R.id.tab_host);
tabHost.setup(getActivity(), getActivity().getSupportFragmentManager(),
…

Anton Holovin
- 5,513
- 1
- 31
- 33
3
votes
1 answer
Difference between TabHost and FragmentTabHost
I have the following tutorials on creating tabs in Android. It is found here and here.
The first one uses FragmentTabHost and the second one uses TabHost in creating the tab with the use of fragments. I have a difficulty in trying to identify its…

princepiero
- 1,287
- 3
- 15
- 28
3
votes
1 answer
Change the indicator of a tab when a button is pressed (Fragments and tabHost)
I'm using fragments and tabHost and everything works pretty well. What I need to do is: When I press a button, it has to take me to another fragment and I need to change the indicator of tab:
When I press the button the fragment is changed but the…

kiduxa
- 3,339
- 11
- 37
- 52
3
votes
1 answer
Replacing a Fragment: Previous view remains Active in the background?
I am working on an application where I have to change the view of one tab when tab is changed. I am doing it following way using OnTabChangedListener. I am able to replace view. But when I change my tab to some other tab, previous view remain…

Usama Sarwar
- 8,922
- 7
- 54
- 80
2
votes
1 answer
How can i pass a variable from my adapter to a fragment i instantiate in Kotlin
I followed a tutorial on getting started with tabhost and fragments, there is the link: https://medium.com/@eijaz/getting-started-with-tablayout-in-android-kotlin-bb7e21783761
But I got a problem, I want to send a value activityID to a fragment that…

Nicolas Felten
- 55
- 10
2
votes
0 answers
Android Tabhost IllegalStateException
I'm using Android's built in Tabhost widget and the following error crashes the app:
Exception java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
android.support.v4.app.FragmentManagerImpl.checkStateLoss…

user3200855
- 31
- 2
2
votes
0 answers
Android: Tab Indicator line disappears when tab background is changed
My question is more or less similar to this question, but the response approved as the answer for the same doesn't solve my issue.
I'm implementing tab structures using the FragmentTabHost class. When the tab background color is not explicitly…

vardhinisuresh27
- 371
- 2
- 6
- 18
2
votes
7 answers
How to get data from two different fragments in tabs to main activity
I want to know how to get data from 2 different fragments inside tab layout.
For example: In this image there two tabs tab1 and tab2 both have different values stored in edit text .
tab1 helloooooo,
tab2 hiiiiiii
and i have a button available…

sunny
- 179
- 2
- 14
2
votes
0 answers
Tabs at the bottom of a fragment
I'm having a Fragment from a mother activity and I want inside it to display two tabs using FragmentTabHost. But I would like the tabs to be located at the bottom of the fragment not at the top, as it is the default.
MainFragment.java:
public…

HarisD
- 21
- 1
2
votes
1 answer
findViewById(R.id.tabhost) always return null
I have an app in Google play already and has no problem at all until I upgrade my Android Studio. The build.gradle has to be modified so that the project can be compiled Here is what I changed:
dependencies {
compile fileTree(dir: 'libs',…

Bagusflyer
- 12,675
- 21
- 96
- 179
2
votes
1 answer
Swipe TabWidget on swipe of viewpager
I'm writing an application where using FragmentTabHost. Each of host child contain ViewPager as Child. Here I want to move control to second TabWidget if user swipe from last page of ViewPager of First TabWidget.
Example: So like Recharge Tab has…

CoDe
- 11,056
- 14
- 90
- 197
2
votes
2 answers
Android studio Fragment TabHost
I want to display a fragmentTabHost in activity_main when a button is clicked.When I click it, it shows "unfortunately FragTabHost has stopped".Below is the code. Please help me!!
MainActivity
public class MainActivity extends Activity {
…

jobin
- 1,489
- 5
- 27
- 52
2
votes
2 answers
FragmentTabHost getting empty fragments after popBackStack
I have tried every post in StackOverflow and have not been successful, i have a FragmentTabHost activity with tabs A B C D E
When i go to tab A and then go to tab B everything is ok, but if i return to tab A is blank, then return to tab B is also…

RonEskinder
- 527
- 8
- 24
2
votes
1 answer
Android TabHost.TabSpec.setContent(...) in nested Fragments "could not find View with Id"
I've been searching for an answer and trying different solutions for a pretty exhausting time now. I am trying to design an android application with nested Fragments with one Fragment containing Tabs. The Problem occurs when I am trying to set the…

dego
- 21
- 3