0

I have an issue that I have an activity include in the initial one fragment shown in it ad works fine it receive keep receive data and update it's ui, but once I add the second fragment to the activity seems like the second one freeze the previous one from updating or receiving anything. have any one an idea about this issue ?

im using this function to add fragment ->

   fun setFragment(fragment: Fragment, fragmentManager: FragmentManager, fragmentId: Int) {
        val fragmentTransaction: FragmentTransaction =
            fragmentManager.beginTransaction().setReorderingAllowed(true)
        fragmentTransaction.replace(fragmentId, fragment).setTransition(TRANSIT_FRAGMENT_FADE)
        fragmentTransaction.commit()
    }
Qasem M. Zreaq
  • 139
  • 1
  • 1
  • 10
  • I think the key issue is the transaction maybe you should invest some time reading the API. IF you remove replace and use add it should fix the problem. If you want a short answer comparing them please read https://stackoverflow.com/questions/18634207/difference-between-add-replace-and-addtobackstack – PedroAGSantos Dec 26 '21 at 18:48
  • I changed replacement to add and still have the same issue once show the second fragment the first one stop update it's ui – Qasem M. Zreaq Dec 26 '21 at 19:03
  • how are you updating the UI ? – PedroAGSantos Dec 27 '21 at 12:14

0 Answers0