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

Nested Fragments Communication

I'm currently having trouble with nesting fragments , I've created a SlidingTabLayout with two tabs , each tab with it's corresponding Fragment , In one tab I've added 5 child fragments to the parent fragment returned by the FragmentPagerAdapter,…
3
votes
0 answers

Trying to attach a nested fragment inside an activity that is being destroyed

I have an activity that contains a fragment: ConversationsFragment It's added to the Activity in this way: private void showFragment(BaseFragment fragment, String tag) { FragmentTransaction transaction = fragmentManager …
Guillermo Merino
  • 3,197
  • 2
  • 17
  • 34
3
votes
1 answer

Error in using MaterialViewPager library in a fragment

I am using this lib: https://github.com/florent37/MaterialViewPager I have a Navigation Drawer , and if I click on one of the items in list in navdrawer the Material View Pager loads up. ( replaces the fragment ). But I get this error there: ( …
3
votes
1 answer

How to add fragment to existing fragment dynamically?

I want to add a fragment to an existing fragment on a button press (button sits on parent fragment) but I get an error: java.lang.ClassCastException: must implement OnFragmentInteractionListener. What does that mean and why doesn't any of the…
KasparTr
  • 2,328
  • 5
  • 26
  • 55
3
votes
2 answers

Nested fragments created twice on orientation change

I created this example to understand the lifecycle of android fragments at screen orientation change. MainActivity is a container for DrawerLayout, DrawerLayout allows you to choose a fragment, which will fill the MainActivity screen. public class…
3
votes
3 answers

Android Backstack with Nested/Child Fragments

I've got a problem with the way backstack of nested Fragments and would be most grateful for any help that is offered. I have Fragment A and Fragment B. Fragment A contains an other Fragment (ButtonFragment). In the onCreate of the Activity I load…
3
votes
1 answer

Null reference exception when using CameraUpdateFactory with MapFragment in an Android FragmentActivity

this is my first post and I would like to do a self Q&A here. :) When embedding a MapFragment (from Google Maps Android API v2) to an fragment activity, I encountered an internal Google Maps Android API null reference exception with the following…
3
votes
2 answers

NullPointerException LayoutInflater.from(context) - Fragment Android

I have implement Nested Fragments. Child fragment contains BaseAdapter. When I switching(replace) child fragments then I am getting Nullpointer exception. Code: public MyAdapter(final Context context, final List
Slk
  • 205
  • 5
  • 12
3
votes
1 answer

Back button issues with Single activity architecture and Multiple Fragments (nested fragments)

Recently in one of my apps re-design , I moved from all Activities to single activity architecture and converted all other activities to fragments. So my app consists of a single activity which has TabHost (4 tabs) that contains fragments. In each…
Handroid
  • 399
  • 1
  • 2
  • 13
3
votes
1 answer

Restore nested fragments on rotation

I have an activity with fragment. A spinner in the fragment determines which of 2 fragments appears below the spinner. These 2 fragments inherit an abstract fragment. In the fragments, the user enters some data in fields. I need to restore the data…
3
votes
1 answer

ListFragment loads empty list after coming back from BackStack

this is my 2nd post on same matter, I am still waiting for someone to guide me. The issue I am facing may be very simple, in short I have this ListFragment which populates the list calling a webservice, this works fine. When user selects any item I…
3
votes
0 answers

Child Fragments recreated on Back Press in Android

As per my requirement for app I have added Child Fragments inside MainFragment, which extends Fragment like below code dynamically on conditions after getting server response: DetailsImageFragment imgFragment =…
3
votes
2 answers

Nested Fragments within ViewPager have zero height and width

I have an Activity with a single Fragment inside of it. Inside this Fragment I have a ViewPager that pages Fragments. This makes the paged Fragments children of the Fragment inside the Activity. Basically like this: Activity | | …
3
votes
3 answers

Android google maps loads on first open then crashes on 2nd open

I have implemented a google map in my android project in a fragment. When I load the fragment the first time it calls an async tasks and loads the markers and displays correctley. But if I move to another fragment and then come back to the map it…
Mike
  • 6,751
  • 23
  • 75
  • 132