android-jetpack-navigation

can I send nullable data type as argument using safeargs ? if not what should I do?

 ̄綄美尐妖づ 提交于 2020-04-30 06:25:27
问题 say I have 2 fragments. Login and Home. I set Home fragment as a global destination that has userData as arguments if the user is not logged in yet, then it will start from login fragment. after login and get userData from server then it will navigate to Home and pass userData using this code val home = AuthenticationFragmentDirections.actionGlobalHomeFragment(userData) Navigation.findNavController(view).navigate(home, navOptions) but the problem is when the user already login and open the

setupWithNavController method for toolbar no longer available?

二次信任 提交于 2020-04-18 05:44:29
问题 so previously I had crash with error: You must call setGraph() before calling getGraph() then after reading the solution frem here. it is said that I have to use these lines on my gradle implementation "androidx.navigation:navigation-fragment:2.3.0-alpha02" implementation "androidx.navigation:navigation-ui:2.3.0-alpha02" and the error is dissapear. but now I no longer can find setupWithNavController method. usually I use this line toolbar.setupWithNavController(navController

setupWithNavController method for toolbar no longer available?

北城以北 提交于 2020-04-18 05:44:13
问题 so previously I had crash with error: You must call setGraph() before calling getGraph() then after reading the solution frem here. it is said that I have to use these lines on my gradle implementation "androidx.navigation:navigation-fragment:2.3.0-alpha02" implementation "androidx.navigation:navigation-ui:2.3.0-alpha02" and the error is dissapear. but now I no longer can find setupWithNavController method. usually I use this line toolbar.setupWithNavController(navController

how to remove back button in the toolbar of top level fragment if I set toolbar in each fragment using navigation component?

旧城冷巷雨未停 提交于 2020-04-17 21:59:36
问题 I have tried to read this but my problem is little bit different. I need some different toolbars, so according the documentation from here , I need to set the toolbar in each of my fragment not in my MainActivity. so I set the toolbar in each xml of my fragment. and then in each fragment I use this code to set the toolbar override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) val toolbar = view.findViewById<androidx.appcompat.widget

how to remove back button in the toolbar of top level fragment if I set toolbar in each fragment using navigation component?

混江龙づ霸主 提交于 2020-04-17 21:58:48
问题 I have tried to read this but my problem is little bit different. I need some different toolbars, so according the documentation from here , I need to set the toolbar in each of my fragment not in my MainActivity. so I set the toolbar in each xml of my fragment. and then in each fragment I use this code to set the toolbar override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) val toolbar = view.findViewById<androidx.appcompat.widget

how to remove back button in the toolbar of top level fragment if I set toolbar in each fragment using navigation component?

℡╲_俬逩灬. 提交于 2020-04-17 21:56:19
问题 I have tried to read this but my problem is little bit different. I need some different toolbars, so according the documentation from here , I need to set the toolbar in each of my fragment not in my MainActivity. so I set the toolbar in each xml of my fragment. and then in each fragment I use this code to set the toolbar override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) val toolbar = view.findViewById<androidx.appcompat.widget

still have error no current navigation node even after using navigation 2.2.1

痞子三分冷 提交于 2020-03-25 13:46:02
问题 I have tried to read this but it doesn't solve my issue so I navigate to next destination using this code val nextDirection = CreateEventNameFragmentDirections.actionToCreateEventType(userKM, newEvent) findNavController().navigate(nextDirection) but it crash after I rotate the device with error java.lang.IllegalStateException: no current navigation node i update the gradle using this implementation 'android.arch.navigation:navigation-fragment-ktx:2.2.1' implementation 'android.arch.navigation

still have error no current navigation node even after using navigation 2.2.1

回眸只為那壹抹淺笑 提交于 2020-03-25 13:45:33
问题 I have tried to read this but it doesn't solve my issue so I navigate to next destination using this code val nextDirection = CreateEventNameFragmentDirections.actionToCreateEventType(userKM, newEvent) findNavController().navigate(nextDirection) but it crash after I rotate the device with error java.lang.IllegalStateException: no current navigation node i update the gradle using this implementation 'android.arch.navigation:navigation-fragment-ktx:2.2.1' implementation 'android.arch.navigation

still have error no current navigation node even after using navigation 2.2.1

两盒软妹~` 提交于 2020-03-25 13:45:02
问题 I have tried to read this but it doesn't solve my issue so I navigate to next destination using this code val nextDirection = CreateEventNameFragmentDirections.actionToCreateEventType(userKM, newEvent) findNavController().navigate(nextDirection) but it crash after I rotate the device with error java.lang.IllegalStateException: no current navigation node i update the gradle using this implementation 'android.arch.navigation:navigation-fragment-ktx:2.2.1' implementation 'android.arch.navigation

Navigation graphs and multiple host activities

醉酒当歌 提交于 2020-01-25 07:28:08
问题 I have a feature module, splash, which has a nav_splash graph and a SplashActivity. When I navigate to a second feature module, main, which has a nav_main graph and a MainActivity, instead of using MainActivity as host (even in the navigation editor it is appearing as host), it keeps using SplashActivity as host. So instead of navigating to nav_main graph, now I have to navigate to an activity (MainActivity) to force the use of this activity as host. Is this intentionally? Or is it a bug? The