0

I'm trying to instantiate a fragment and have it replace another fragment. Looking at multiple sources hasn't worked, yet. When I use the findNavController to see if the other fragment does indeed show, it works, but as a test, I tried replacing a fragment with itself, using the replace function, I receive the following error below:

enter image description here

I am building a quiz app. The goal is to use fragments, and have the inputFragment (containing input questions) and multiFragment (containing multiple choice questions) be used together at the same time, while pulling data from my Firebase DB, where my different types of questions are stored.

findNavController opens the inputFragment (black), but as soon as I use replace, the App breaks. Here are screenshots of my code and errors: Hope someone can help....

enter image description here enter image description here

  • If you're using the NavController, you can't write a FragmentTransaction to replace its contents and a nested (child) fragment cannot ever using the activity's FragmentManager. Can you explain what you were hoping to do with that code? – ianhanniballake Aug 23 '22 at 02:19
  • Post code of fragment categories fragment xml. Also R.id.categoriesFragment is present in which xml file? – Gowtham K K Aug 23 '22 at 03:31

0 Answers0