NavController no current navigation node after device rotation

后端 未结 4 964
予麋鹿
予麋鹿 2020-12-31 08:08

I am making app, which supports different device orientations. Navigation is carried out by Android Jetpack\'s Navigation. App main screen for landscape orientation is prese

4条回答
  •  误落风尘
    2020-12-31 09:04

    None of these solutions fixed my issue.

    I fixed it by including my nested graph into the main graph.

    I have a nav_main which includes a nav_sub_1.
    nav_sub_1 also includes another sub graph, nav_sub_2
    When I tried to start my activity by setting nav_sub_2, the IllegalStateException occured

    java.lang.IllegalStateException: no current navigation node

    But this would not happen by setting nav_main or nav_sub_1.

    My main graph nav_main looks like this:

    
        
    

    I included nav_sub_2 in nav_main and the issue was fixed!

    
        
    

提交回复
热议问题