Questions tagged [child-fragment]

A child-fragment is a Fragment nested inside another Fragment.

If this Fragment is a child of another Fragment, the FragmentManager returned here will be the parent's getChildFragmentManager().

Official Support v4 Fragment Documentation

37 questions
1
vote
2 answers

getChildFragmentManager() and containerId

I create a child fragment in the parent fragment code using getChildFragmentManager(), a containerId, and the method .add(). Then I attempt to replace that childFragment inside the onActivityCreated() method of the childfragment code using…
Lv99Zubat
  • 853
  • 2
  • 10
  • 27
1
vote
1 answer

Getting IllegalStateException with removing a child fragment

I am using child fragments. Fragment A adds a child fragment B: B fragment = new B(); // B is a child getChildFragmentManager().beginTransaction().add(fragment, null).commit(); Then later B removes itself with the following: // in the B's…
Vit Khudenko
  • 28,288
  • 10
  • 63
  • 91
0
votes
1 answer

childFragmentManager.findFragmentById(R.id.nav_host_fragment_challenges) returns null

Thanks to a bottomNavigationView, I use NavController to navigate between 4 different fragments. In one of these fragments (ChallengesFragment) I have an inner_fragment (nav_host_fragment_challenges) but when I try to navigate in this inner_fragment…
0
votes
0 answers

How to get the MessageFragment from ChatFragment (bottomNavigationView)

I have a little problem with the Fragments. When I want to recover the Fragment named MessageFragment who works like a list of message for use to my webservice. To more understand, I have a bottomNavigationView to control the pages named "Home",…
0
votes
0 answers

How to recreate from childFragmentManager?

I am using a custom layout for my settings Fragment like this class SettingsFragment : BaseFragment() { private var settings: FragmentSettingsBinding? = null override fun onCreateBaseView( inflater: LayoutInflater, parent:…
Mark Delphi
  • 1,376
  • 1
  • 11
  • 29
0
votes
1 answer

How to handle back button when using Nested Fragments in Android

I have a Home fragment with multiple buttons and when I click the Contact button, another fragment is opened. Inside this fragment I have two child fragments and two buttons, and I can switch between those child fragments using those buttons. The…
0
votes
1 answer

Why childFragmentManager.getBackStackEntryCount() is always 0?

I'm trying to popBackStack on childFragmentManager if a childFragment is added but when I check if getChildFragmentManager.getBackStackEntryCount() is > 0, it's always false. Any suggestions on this isue? @Override public void onBackPressed() { …
0
votes
1 answer

Child Fragment Destroyed Automatically Once App Goes To Background - Android

In the activity, there is BottomNavigationView with 3 parent Fragments. Each fragment can have child fragments. There is no issue in creating child fragment from the parent fragment, here is the code: getActivity().getSupportFragmentManager() …
Faisal Shaikh
  • 3,900
  • 5
  • 40
  • 77
0
votes
1 answer

child fragment scrolls parent fragment if child has no scrollable content

I have a parent fragment with a CoordinatorLayout as root layout and i am showing different child fragments inside parent fragment. Child fragments may have scrollable content and unscrollable content. In a scrollable child fragment, if scroll…
0
votes
2 answers

Return result from fragment just as startActivityForResult in case Activity

I have an activity in which I am adding fragments.There is a Fragment(WhenFragment) on which I add another fragment (DateSelectionFragment) to get the date and when I back press I need that date and want to set in a text view.I used…
Afzal Khan
  • 336
  • 3
  • 16
0
votes
1 answer

Type mismatch. Required: Fragment, Found: PlaceAutocompleteFragment

I bumped into a Duplicate ID, tag null, or parent id with another fragment for placeAutocompleteFragment error, and so i followed this solution to try and fix it by adding the placeAutocompleteFragment via a fragment transaction using the…
0
votes
1 answer

No view found for id 0x7f0800c4 for fragment

I get this error when I am trying to replace the parent fragment (SearchFragment) from the child fragment (ClassroomsTab) in a swipe tab viewPager. Basically what I am trying to achieve is have a swipe tab menu with multiple buttons in each child…
0
votes
0 answers

Android - How to make fragment transition animation with toolbar using getChildFragmentManager

I try to implement a navigator object. It has own stack. My activity layout hierarchy is below:
us2956
  • 476
  • 12
  • 27
0
votes
0 answers

How to destroy views or asynchronous calls in a child fragment of a view Pager fragment Android

I have two fragments in a ViewPager while in the first one I have added two more child fragments and these two child fragments have views and asynchronous calls in them. Now when I swipe from one fragment of viewPager to other and then come back on…
0
votes
2 answers

Android child fragment not null after removing

I'm trying to run some operations based on whether a child fragment exists. Here is my code: private void addChatFragment() { getChildFragmentManager() .beginTransaction() .add(R.id.chat_container,…
jwBurnside
  • 849
  • 4
  • 31
  • 66