Questions tagged [android-nested-fragment]

Nested android fragments represent fragments which are embedded in other fragments.

Nested fragments were introduced in the Android SDK starting with API level 4.2. They are also available on lower API versions through the support compatibility package.

By using getChildFragmentManager()(method of the Fragment class), a fragment can have the behavior of a FragmentActivity. The nested fragments workflow closely follows the one of a normal fragment(which is embedded at in an Activity). For more information about fragments, see the Google Documentaton.

When asking questions about nested fragments one should always add the tag, optionally the could also be added.

281 questions
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…
37
votes
5 answers

getParentFragment returning null

I have a Fragment that has a FrameLayout. This first fragment (A) loads inside its Framelayout another fragment (B). When I call getParentFragment from inner fragment (B), I get null. How should this method be used properly?
Gonzalo
  • 3,674
  • 2
  • 26
  • 28
30
votes
4 answers

Android: Can you nest Fragments?

Is it possible to stick a Fragment in the layout of another Fragment? Has anyone tried this?
Christopher Perry
  • 38,891
  • 43
  • 145
  • 187
29
votes
2 answers

getChildFragmentManager() on programmatically (dynamically) added Fragments?

How to use (or "Can we use") getChildFragmentManager() on programmatically (dynamically) added Fragments? Here is my example. I have one MainActivity, one OuterFrag, and one InnerFrag. I will add the OuterFrag to MainActivity dynamically by the…
midnite
  • 5,157
  • 7
  • 38
  • 52
28
votes
1 answer

Android : Parent fragment of a nested fragment

A getParentFragment() from my nested fragment is returning a null. I realise that getting a null means that the fragment is attached to the activity and not to the nested container fragment. But I am explicitly nesting the child fragment inside the…
Abhijith Madhav
  • 2,748
  • 5
  • 33
  • 44
20
votes
3 answers

NoSuchMethodError getChildFragmentManager()

I'm trying to implement a ViewPager with a FragmentPagerAdapter, where the ViewPager itself is located inside a fragment. I've read in the docs that it should be possible with the newest Support Library and by using nested fragments. Principally I…
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…
19
votes
4 answers

Nested Fragments and The Back Stack

Does the Back Stack support interaction with nested Fragments in Android? If it does, what am I doing wrong? In my implementation, the back button is completely ignoring the fact that I added this transaction to the back stack. I'm hoping it is…
MikeS
  • 3,891
  • 6
  • 35
  • 51
18
votes
2 answers

Nested fragments transitioning incorrectly

Hello good programmers of stack overflow! I've spent a good week with this problem and am now very desperate for a solution. The scenario I'm using android.app.Fragment's not to be confused with the support fragments. I have 6 child fragments…
18
votes
4 answers

Getting reference to nested fragment from FragmentTabHost

In my application, I use an Activity which holds one Fragment with FragmentTabHost and hence all its tabs are nested Fragments. Inside an Activity which holds a Fragment with its nested Fragment, we may get a reference to attached one using…
17
votes
6 answers

FragmentManager popBackStack doesn't remove fragment

I'm implementing menu navigation using Fragments. So I begin with Home, and then users can navigate to diferent sections and details of each section. When a user changes section, then I call pop on the fragmentmanager backstack until I reach Home,…
16
votes
2 answers

getChildFragmentManager() and support libraries

I am using the getChildFragmentManager() in an app that is compiling against API level 19, with the minimum SDK set to 14. getChildFragmentManager() was introduced in API 17, so devices running at API levels 14, 15, or 16 will throw a…
Mark
  • 7,306
  • 8
  • 45
  • 87
15
votes
1 answer

ViewPager inside fragment issue

I'm having problem with view pager which is inside of some fragment. To work with view pager I'm using FragmentPagerAdapter. And sure I'm getting java.lang.IllegalStateException: Recursive entry to executePendingTransactions exception when trying…
15
votes
1 answer

DialogFrag#show() from a Fragment throwing "IllegalStateException: Can not perform this action after onSaveInstanceState"

Just to be clear, I have read the dozen top SO questions on "IllegalStateException: Can not perform this action after onSaveInstanceState" and I have read Alex Lockwood's blog post on the issue…
15
votes
2 answers

Adding a fragment to a dialog

I would like to add a fragment to a dialog (it can be either a DialogFragment or a regular Dialog). How do I do that? Here's my DialogFragment: public class MyDialogFragment extends DialogFragment { public View onCreateView(LayoutInflater…
1
2
3
18 19