Questions tagged [android-fragment-manager]
26 questions
5
votes
0 answers
IllegalStateException: Fragment DetailFragment did not return a View from onCreateView() or this was called before onCreateView()
I got a weird error:
java.lang.IllegalStateException: Fragment DetailFragment{478548c} (790a9d4b-aae5-425a-a41d-2ab5785e5479) id=0x7f0b1c79 DetailFragment} did not return a View from onCreateView() or this was called before onCreateView().
at…

Alexander Tumanin
- 1,638
- 2
- 23
- 37
4
votes
2 answers
Where is the supportFragmentManager variable defined?
I'm using Kotlin for development. When I reached the official Android tutorial's fragment section, I came across the supportFragmentManager. Which is available to use as a variable in Kotlin, whereas in java we can call its equivalent method…

fayis003
- 680
- 4
- 10
3
votes
4 answers
java.lang.IllegalStateException ConstraintLayout does not have a NavController set for a fragment
I have an activity (main) with three fragments (first, second and third). I included the 3 fragments in my activity (activity_main.xml) by using .
The content_main.xml is using FragmentContainerView with id…

carl
- 388
- 2
- 19
1
vote
0 answers
Restore Fragment with WebView without reloading the webview content
I’m happy to learn that the navigation library finally saves and restores Fragment state since version 2.4 (release notes ), which is useful in a Bottom Navigation scenario to not completely rebuild screens when switching tabs.
Before, I would…

Nino van Hooff
- 3,677
- 1
- 36
- 52
1
vote
1 answer
FragmentContainerView in ViewHolder - which is the appropriate FragmentManager?
I am including a fragment in a row for a RecyclerView - I know it is not the most recommended thing to do, but it is not used much and I would like it as a Fragment as we are using it multiple places.
I have added this in the view for the…

Morten Holmgaard
- 7,484
- 8
- 63
- 85
1
vote
0 answers
Two fragments are displaying at the same time after pressing back button on added last fragment which wasn't added to back stack
For example I have one activity and three fragments (1, 2, 3).
I show first fragment, then second fragment (adding it to back stack) and third fragment (no adding it to back stack because when pressing the back button I want to go to the first…

user924
- 8,146
- 7
- 57
- 139
1
vote
2 answers
Cannot resolve method super() error in fragmentmanager Android
I am not a Java coder but trying to build an app while trying to learn Java along the way.
I am trying to add 2 fragments one is the login fragment and one is the register fragment but while using super constructor I am facing cannot resolve…

Novneet Patnaik
- 23
- 1
- 5
0
votes
1 answer
Close Dialog from Activity open in Child Fragment in NavGraph
I want to close any dialog open from nav_graph on some event.
NavHostActivity.kt xml

Taimoor Khan
- 541
- 4
- 20
0
votes
1 answer
Switching between 2 fragments without recreating them each time solution not working? - Android Studio (Java)
I have been trying to get my android app to be able to that when you switch between fragments it retains the actions you've done in the fragments. I want to be able to switch between fragments without re-creating or replacing them, just showing and…

johndo19
- 13
- 3
0
votes
0 answers
Navigating from one fragment to another using Fragment manager in kotlin
I am trying to navigate from one fragment to another using Fragment Manager but the app exits when the button is clicked. I tried a few solutions from the internet but
I am still not able to figure out why. Please help. Thanks in advance!
Groups.kt…

Jayashree K
- 131
- 2
- 3
- 16
0
votes
0 answers
How to use 2 Fragment Manager for same Activity
I came up with something new, trying to use 2 Fragment Manager for same activity.
So for that I did some customization with help of FragmentHostCallback<{Activity}> and FragmentConroller class.
val fmCallBack_1 = DemoHostCallBack(this,…

Dnveeraj
- 117
- 3
- 15
0
votes
0 answers
Android. IllegalStateException: FragmentManager is already executing transactions when show DialogFragment
Here is my code to show DialogFragment from another fragment:
override fun showDialog(dialog: DialogFragment, tag: String?) {
val fragmentManager = fragment.childFragmentManager
if (tag != null) {
…

testivanivan
- 967
- 13
- 36
0
votes
1 answer
Incorrect work of the fragmentManager in conjunction with the Jetpack Compose
I added jetpack compose into my old project and I have noticed one problem with fragmentManager work.
In short, I have the following transactions:
MainActivity -> SettingsFragment -> BackgroundSettingsFragment.
When we go to…

San
- 64
- 1
- 6
0
votes
1 answer
Child fragment's parent returns NavHostParent instead of actual parent fragment
I have the following structure:
Activity
NavHostFragment (with navigation graph)
Fragment1
ChildFragment
Fragment2
ChildFragment
Fragment3
I want to access either Fragment1 or Fragment2 from…

htafoya
- 18,261
- 11
- 80
- 104
0
votes
1 answer
Data reset when moving from one to another fragment using Bottom Navigation Bar
I am using bottom navigation bar dan fragment in my project.
When it moved from one to another fragment, I dont want to lose the state or data
How can I do it?
This is activity_main.xml

M. Noval Hidayat
- 21
- 4