Closed grajadurai28 closed 5 years ago
Found the issue. We were using the NavController
to switch between two NavGraph
using the same NavHostFragment
. The default NavGraph
- nav_home
is set in the onCreate
of the Activity
. The other NavGraph
- nav_settings
is set on selecting the Settings option.
The theming logic is part of the nav_settings
graph. So, when cyanea
restarts the Activity
to apply theme, onCreate
gets called and NavController
sets the NavGraph
back to nav_home
.
The NavController
then tries to find the Settings page in nav_home
. Hence, the crash.
The only way around this is to store the current NavGraph
id in ViewModel
or savedInstanceState
and use it in onCreate
to set the correct NavGraph
Will close this issue now. Thanks
I also had this last one, and I would like to have a prototype of correction to solve this problem finally, an example of resolution (pseudo code) you will have already deduced it from my accent I am French-speaking ... all my excuses
Hi,
I am using the new Navigation Architecture for Fragment transactions. My home screen has a
NavHostFragment
defined in its layout.For theming I am using the
CyaneaThemePickerActivity
. After picking a theme, if I press the back button to navigate back to the home screen, I get this crash. I am unable to find out what the root cause is.Adding the stack trace below for reference,