Questions tagged [android-fragment-manager]

26 questions
0
votes
1 answer

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.checkAnswersButton.setOnClickListener { …
0
votes
1 answer

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 Fragment A and my Fragment A will be reloaded. My…
Asghar Hosseini
  • 239
  • 1
  • 5
  • 14
0
votes
1 answer

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 in the activity with this fragment but as soon as…
0
votes
1 answer

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 element of the array, create a fragment within a…
0
votes
1 answer

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 please tell me i will update the question with…
Vasant Raval
  • 257
  • 1
  • 12
  • 31
0
votes
1 answer

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 Reference of any file or want to see other…
Vasant Raval
  • 257
  • 1
  • 12
  • 31
0
votes
2 answers

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 = fragmentManager.findFragmentById(R.id.my_container); …
CodingChap
  • 1,088
  • 2
  • 10
  • 23
0
votes
2 answers

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 androidx.fragment.app.FragmentContainerView but I still…
0
votes
0 answers

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 androidx.fragment manager final FragmentTransaction…
sejn
  • 2,040
  • 6
  • 28
  • 82
0
votes
0 answers

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 when activities are created? Something like save…
0
votes
1 answer

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) { /** * do some staff here */ //now we…
1
2