Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If you are unable to redraw NavGraph fragments using setGraph(), you may try one or more of the following solutions:

  1. Use Navigation Action: You can create a navigation action to navigate to the fragment you want to display and call the action using Navigation.findNavController(view).navigate(actionId).

  2. Use FragmentManager: You can use FragmentManager to replace the current fragment with the target fragment.

  3. Use Dynamic Feature Module: If you have implemented your app with dynamic feature modules, you can use them to load new content without having to redraw the entire NavGraph.

  4. Use LiveData: LiveData can help you update the UI every time the data changes. You may set up a LiveData observer in each of the fragments, and whenever you need to redraw the fragments, you can update the LiveData values.

  5. Use ViewModels: You can store the state of the app in ViewModels and use them to redraw the fragments whenever necessary.