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
1
vote
1 answer

Navigation drawer item is Fragment that has tabs

I'm trying to implement a two tabs and also have a navigation drawer. I'm able to do both separately but when I try to combine the two I run into problems. I originally had the code for creating my two tabs and the nav drawer inside my MainActivity…
1
vote
2 answers

PagerAdapter not called inside fragment when I move to the fragment for the second time in Android

I'm working with viewpager inside fragments. I'm using pagerAdapter to switch between two pages via XML. Here is the code: public class DemoPagerAdapter extends FragmentPagerAdapter { public DemoPagerAdapter(FragmentManager fm) { …
1
vote
1 answer

How getChildFragmentManager() supports all API levels

When there is a need to use getSupportFragmentManager() to support lower API levels, I think using getChildFragmentManager() method. How this method supports all API levels?
saravanan
  • 5,339
  • 7
  • 45
  • 52
1
vote
3 answers

getChildFragmentManager() method is undefined

I have the same issue has this post: android.support.v4.app.Fragment: undefined method getChildFragmentManager(). I need to use getChildFragmentManager() because I'm using nested fragments. My problem is: the solution in the other post does not work…
dasdasd
  • 1,971
  • 10
  • 45
  • 72
1
vote
2 answers

Commiting FragmentTransaction in 1 Tab of a FragmentPagerAdapter

I'm using FragmentPageAdapter to have multiple tabs within my app. 1 of those tabs is a ListFragment that is supposed to be replaced by another fragment onItemClick, using FragmentTransaction. The change replace works perfectly if I add the…
1
vote
2 answers

How to add dynamic fragment in nested fragment with three pan layout

I am trying to build a three pane layout (three ListFragment). I am able to create it inside an activity by following layout
Kaidul
  • 15,409
  • 15
  • 81
  • 150
1
vote
1 answer

Cannot replace a Fragment with a new one

I am trying to replace a Fragment inside another Fragment and I get a weird NullPointerException, could you please take a look and tell me what do you think? Here is my code: public class HomeScreenFragment extends Fragment implements…
Adrian Olar
  • 2,883
  • 4
  • 35
  • 63
1
vote
3 answers

Why can't nested Fragments use XML?

Googling I see many declarations that nested fragments cannot use XML. Now I am new to Android, but my app is using XML with nested fragments. I haven't got the listeners and interfaces working yet (maybe this is why people say you can't use XML),…
1
vote
1 answer

Is Nested Fragment Possible?

I have a ViewPager contains three fragment, and I want to put 3 new fragments into the third fragment.Is that possible? [ViewPager] [Fragment 1] [Fragment 2] [Fragment 3] [Fragment 3-1] [Fragment 3-2] [Fragment…
1
vote
1 answer

Viewpager Tabs Fragment

I have a viewpager in a fragment that works correctly on start up but if reload the fragment by replace() or replace with another fragment then load it again. The viewpager doesn't work correctly. I have 4 tabs in my pager and depending on which…
1
vote
1 answer

Refreshing a fragment View on back from settings change

What I'm trying to accomplish is have my view refresh when someone comes back from the settings and changes their preference. I thought this would work but it is not. Any ideas on how i can accomplish this? import java.text.SimpleDateFormat; …
jcaruso
  • 2,364
  • 1
  • 31
  • 64
1
vote
2 answers

Android: Use of MapFragment within one of a number of Fragments

I searched and searched, no one answer it in totality. I have a project that needs to use the new MapFragment within one of a number of Fragments in an Android project. I have it so far like a FB mobile app. It shows a menu on the left and user can…
user1763763
  • 1,143
  • 2
  • 8
  • 8
0
votes
0 answers

Nested Child Fragment Disappear after Configuration change (Screen Rotation, Device theme change)

In the MainActivity of my android application I have added a default fragment (HomeFragment) to show when the activity is launched. Inside the HomeFragment, I have added another fragment (ResourceCountFragment) to create different components in the…
0
votes
0 answers

Replacing fragment with multi fragments (nested fragments) in Android (Kotlin) not working

I'm trying to instantiate a fragment and have it replace another fragment. Looking at multiple sources hasn't worked, yet. When I use the findNavController to see if the other fragment does indeed show, it works, but as a test, I tried replacing a…
0
votes
0 answers

Android: Handle back button in nested fragments

I'm handling back button of device via fragments but while calling from nested fragments I'm facing issue. It always calls the backPressed method of MainActivity. I'm handling it as: class MainActivity : BaseActivity() { protected fun goToHome()…
Anshul Tyagi
  • 2,076
  • 4
  • 34
  • 65