26 questions
0
votes
1
answer
140
views
Android. How to share result from one fragment to another with fragment result api?
I'm trying to share result from one fragment to another with fragment result api.
Here is my fragment structure:
Activity - container contains: FragmentA, FragmentB, FragmentC.
At the same time ...
0
votes
0
answers
31
views
Two similar bottom sheets but one needs childFragmentManager and other one parentFragmentManager! Why?
I accept that I am not master in fragment manager. But I expect that two similar BottomSheets behave similarly.
I have a CustomBottomSheet (extend of BottomSheetDialogFragment). I have created a new ...
0
votes
1
answer
37
views
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
<fragment
android:id="@+id/fragment"
android:name="androidx....
0
votes
1
answer
361
views
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 ...
0
votes
0
answers
71
views
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 ...
0
votes
1
answer
636
views
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 -> ...
0
votes
1
answer
314
views
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 ...
0
votes
1
answer
644
views
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
<...
1
vote
0
answers
250
views
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 ...
0
votes
1
answer
3k
views
How to refresh fragment by clicking on button
I want to refresh my fragment by clicking on its button. How to do it?
I try to do it like this but old version of fragment appears on the top of the screen (picture is attached):
binding....
0
votes
1
answer
1k
views
Reload Fragment after popBackStack
I need reload fragment after this process
Go from Fragment A to Fragment B and go from Fragment B to Fragment C, then do the registration process, and after the registration is correct, popBackStack ...
0
votes
1
answer
215
views
I'm trying to create a spinner in a Fragment and fill it using ArrayList but the app keeps crashing
This is my first time using Fragments in Android and I'm trying to create a spinner and fill it using an ArrayList. My app has 3 buttons on the main screen, the first button replaces the FrameLayout ...
0
votes
1
answer
1k
views
Is there a way to dynamically create fragments and display data to them using the same layout?
I have written code that fetches a JSON object from a remote endpoint. For this question, I am passing in a mock object which is an array of objects.
My goal is to deconstruct the object and for each ...
0
votes
1
answer
64
views
addToBackStack is not navigating back to the correct fragment
hello im trying to include a backstack to EditProfile Fragment that when back is pressed it goes back to Profile Fragment but it goes back to the Home Fragment
if you want more refrence of the code ...
0
votes
1
answer
131
views
Fragment is not starting from menu item when pressed
I'm trying to start a fragment from the toolbar (the toolbar is in a fragment too) but it's not starting, that was not the case when it was in the main activity it was working fine.
If You Want More ...
0
votes
2
answers
143
views
Does findFragmentById take in a FrameLayout rather than a Fragment?
I'm new to the concept of Fragments
In the video I was watching, they used this piece of code:
FragmentManager fragmentManager = getSupportFragmentManager();
Fragment fragment = ...
0
votes
2
answers
709
views
FragmentManager field null android
So I am trying to switch to another fragment by clicking one of the tabs in my BottomNavigationView but I keep getting NullPointer Exception.
I tried changing the fragment tag in my xml file to ...
2
votes
1
answer
1k
views
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.
...
0
votes
0
answers
761
views
Declared target fragment that does not belong to this FragmentManager in androidx (Android studio java)
I am trying to navigate from a fragment to another one fragment after the creation of post. It shows the Declared target fragment that does not belong to this FragmentManager. I have upgraded to ...
1
vote
0
answers
536
views
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 ...
4
votes
4
answers
4k
views
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 <include layout="@layout/content_main"/&...
5
votes
0
answers
2k
views
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 ...
0
votes
0
answers
93
views
Share same fragment state along all activities
I have a fragment which shows system state like battery, wifi or other things like that and I have it at the top of Activities.
It's possible to save state between activities instead of initialize it ...
0
votes
1
answer
157
views
Activity's incapability with androidx
I encountered to a problem related to Activity's getFragmentManager() incossitency with androidx.FragmentManager.
So I have the following method:
public void myMethod(Activity activity) {
/**
...
1
vote
2
answers
2k
views
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 ...
4
votes
2
answers
380
views
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 ...