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

No view found for id, while calling child fragments

So i have on MAIN ACTIVITY(M), two FRAGMENTS(F1, F2) and a BUTTON(B) on F1. Now when the main activity is started F1 is automatically loaded which is fine, what I want to do is start F2 when I click on B which is on F1. Following is my code for…
Varun Barve
  • 323
  • 2
  • 8
  • 18
3
votes
1 answer

Toggle between MapFragment and ListFragment

I am creating an App where I want to switch between my CustomMapFragment and a ListFragment. If I start the App and call replaceFragment: private void replaceFragment(final Fragment fragment) { final FragmentManager fragmentManager =…
3
votes
2 answers

Nested Fragment with backstack Resume

In my application there are several fragments in an activity and I am maintaining a backStack for these fragment. Everything is okay, but there is a nested fragment among them. When I put it into backStack and again resume in by pressing back…
Kaidul
  • 15,409
  • 15
  • 81
  • 150
3
votes
1 answer

Display Two Fragments at the same time

From FragmentPagerAdapter in case 0 I instantiated fragment A this fragment I wanted to display display two fragments inside frag A. The view is not displaying. MyFragmentPagerAdapter is called by the main class to populate the viewpager. …
rahstame
  • 2,148
  • 4
  • 23
  • 53
2
votes
1 answer

Recycler view doesn't render inside Fragment

I have a fragment where I am trying to display a recyclerview with few data. But nothing seems to be working, the emulator finally shows a blank screen. The PreferenceMenuFragment is added via xml inside Settings Fragment layout. The full hierarchy…
2
votes
0 answers

Retain Backstack for Bottom Navigation Bar Android Studio (Java)

as per my name I am new to this, and need help. This is a simple app with one main activity that has a bottom navigation bar used to navigate to multiple different fragments. In the main activity, clicking on R.id.nav_first/second in the navigation…
2
votes
0 answers

In nested Fragment,when TabLayout changes new instance of fragment added but RecyclerView not updating

I have a Fragment named HomeFragment, consisting of a TabLayout and ViewPager in it. TabLayout is populated with data from backend. So each tab item has a name and on changing the tab position, I fetch data from backend and add another fragment,…
2
votes
1 answer

Fragment inside a viewpager doesnt show when is in recyclerview

Maybe this is a stupid question, but this is ruining my day... I have a recyclerview in a fragment override fun setUpRecyclerView(pics: List) { recyclerView.setHasFixedSize(true) layoutManager = LinearLayoutManager(context) …
moskis
  • 1,136
  • 10
  • 20
2
votes
3 answers

Call child Fragment method from parent fragment when child view is available?

I have searched for solution and found so many cases (not relevant to my situation or may be i didn't understood them properly). My case is : Let's say i have one parent Fragment Parent; And i'm creating two child fragments form parent fragment's…
2
votes
1 answer

Android custom view and nested fragments

I have a parent fragment in my view in which 2 child fragments are added programmatically to display maps. This is the layout for the child fragment, the map is rendered in FrameLayout. location_field_view.xml
2
votes
2 answers

Binary XML file line #26: Duplicate id, tag null, or parent id with another fragment

I'm trying to insert a fragment to another and I’ve succeed to do this until I’ve lunch the main fragment for the first time it's working but when I’m trying to reload the fragment the app crash, and i have this error: Caused by:…
Rgv
  • 504
  • 5
  • 23
2
votes
1 answer

Nested fragment with viewpager where viewpager not loading the fragments

I have a activity in which i am loading a fragment Home fragmentA = new Home(); android.support.v4.app.FragmentTransaction fragmentTransactionA = getSupportFragmentManager().beginTransaction(); …
2
votes
1 answer

ViewPager setOffscreenPageLimit not working when using it as NestedFragment with getChildFragmentManager

I am trying to do something similar as https://stackoverflow.com/a/24437224/2277631. I am even using the same layout: I am following this approach because I am using a NavigationView (each option is a fragment) that has the first option as a…
2
votes
0 answers

Android ViewPager Nested Fragment Lifecycle

I am using nested fragments and viewPager together. Following is my code for HomeFragment which is one of the fragments in viewPager. HomeFragment holds another fragment called FeedFragment which is just a RecyclerView. Inside FeedFragment I am…
Sohail
  • 1,137
  • 2
  • 12
  • 22
2
votes
2 answers

onCreateView() of nested fragment is not called

I have been going through nested fragments documentation, best practices and all possible links here in StackOverflow. I have seen suggestions to avoid using fragment tag in layout files and instead add them via transaction for seamless…
Nicks
  • 16,030
  • 8
  • 58
  • 65