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
5
votes
1 answer

ActionBarSherlock with ViewPager not calling ViewPager fragments lifecycle methods when going to and returning from backstack

I have an application that uses ActionBarSherlock and inside the main fragment I have a ViewPager which uses several fragments to display different objects of a list. Main Fragment: public class CollectionDemoFragment extends SherlockFragment…
5
votes
1 answer

Fragments not visible after tab-switch in nested FragmentTabHost

I have a FragmentTabHost in the layout of one of my fragments (let's call it parentFragment). Now, I initialize each of the fragments that go in the tabhost programmatically in onCreateView of the parentFragment. When the parentFragment is created…
4
votes
4 answers

How to manage Backstack with child fragments?

I am having issues with nested/child fragments. My use case is: I have Frag A as parent fragment and FragChild1, FragChild2, FragChild3 as child fragments to be displayed inside Frag A. Now on back press from FragChild3 it should work like…
4
votes
0 answers

How to save and restore state of automatically added nested fragment?

Quick note: I did my due diligence before asking the question: I know that this sounds like a dupe. But none of the existing questions ask the exact question I have, and none of the solutions on the existing questions work for me. Thanks. TL;DR:…
Rohan Dhruva
  • 1,194
  • 1
  • 10
  • 20
4
votes
4 answers

Correct way to remove all (Child) fragments

I load a bunch of Child fragments dynamically inside a Parent's Fragment linearLayout (fragmentContainer), then when user clicks a button, I need to remove them all and add new ones. I don't know the exact number of fragments that will be added each…
ThanosFisherman
  • 5,626
  • 12
  • 38
  • 63
4
votes
1 answer

Android adding Fragment inside Fragment

Hi there (and thanks in advance), I have an application with a Google Play Store-like layout (using PagerTabStrip with 5 sub fragments). In some of those fragments I will need to display a little info regarding the last time the data was updated. I…
4
votes
1 answer

getChildFragmentManager() and viewpager

I have the same problem as Navigating back to FragmentPagerAdapter -> fragments are empty but would like some clarification on the solution of using getChildFragmentManager(). This solution uses getChildFragmentManager(), the manager for fragments…
4
votes
5 answers

How can I call a method from nested fragment

I have a fragment(this is one tab of my tabhost) "fragA" inside other fragment "fragB" but I need to call one method of "fragB" from "fragA". when I do from an activity, I do this: FragB…
4
votes
2 answers

No view found for id - DialogFragment + Fragment

I have a DialogFragment with a simple layout. I want to add a fragment (and in the future replace this fragment with another) to a FrameLayout that is inside the DialogFragment's layout. However, the method of adding the new fragment fails with the…
4
votes
1 answer

Can't invoke getChildFragmentManager in Fragment

I am building android project with maven. But I found when I call getChildFragmentManager in v4.Fragment, it shows an error that this method is not found. I doubt that the support-v4 package is not newer enough because if I using ant to build my…
Frank Cheng
  • 5,928
  • 9
  • 52
  • 80
4
votes
3 answers

Fragments inside a fragment Android application

I'm trying to put 2 fragments inside a fragment. I found some code on internet but, as far as I could go, I don't succeed to put 2 fragments in 1 fragment. I have seen tips dealing with FragmentManager and especially the method…
4
votes
0 answers

ViewPager inside Fragment doesnt show despite using getChildFragmentManager() when constructing FragmentPagerAdapter

I have a viewpager inside fragment. I would like to use FragmentPagerAdapter to swipe between fragments inside my viewpager. public static class MyFragmentPagerAdapter extends FragmentPagerAdapter { public MyFragmentPagerAdapter(FragmentManager…
3
votes
0 answers

RecyclerView does not scroll in Nested Fragment

I am using NavigationDrawer and on item selection, I am changing fragment using hide/show technique instead of replace. if(fragmentManager.findFragmentByTag(TAG_TASKS_FRAGMENT) != null){ //if the fragment exists, show it. …
3
votes
1 answer

Nested fragments no view found for id

I am working on simple application having nested fragments with tab layout. Parent activity is LandingActivity. Inside of the LandingActivity i am calling LandingFragment. Inside of the LandingFragment i have following functionlity. Tasks TAB…
malli
  • 642
  • 2
  • 12
  • 30
3
votes
2 answers

State of nested Fragments is lost when re-attached to their fragment container in bottom tab navigation

I am working on an app that has the following UI structure: One Activity, called FoodActivity This Activity implements bottom navigation. Hence, can show three categories of food: fruit, meat and fish The Activity has a big Fragment container,…