Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
9 events
when toggle format what by license comment
Apr 21, 2021 at 9:39 comment added carl It is incomprehensible why Navigation does not maintain a list of fragments, for example needed when MainActivity wants to call a method in a child fragment. In consequence, you need to use the "good old ways" for that, and then, whats the point of introducing a Navigation system? I don@t get it.
Apr 18, 2021 at 17:18 comment added Miha_x64 Well, to share ViewModel between two fragments, one of them must be its owner. And the other one must find that owner in order to fetch that ViewModel. So… just never use Navigation, it's retarded.
Jan 24, 2021 at 14:15 vote accept BenjaminBihr
Jan 24, 2021 at 14:15
Dec 11, 2019 at 6:17 comment added isabsent @ianhanniballake: Sorry, I didn't understand is there a way to get the foreground fragment by means of getPrimaryNavigationFragment() now or they are going to provide such opportunity in the future only!?
Apr 17, 2019 at 18:25 comment added Sever Big thanks. It works. val navHostFragment = supportFragmentManager.primaryNavigationFragment as NavHostFragment val yourFragment = currentFragmentClassName.childFragmentManager.primaryNavigationFragment as YourFragment
Apr 17, 2019 at 18:03 comment added ianhanniballake @Sever - see this issue and how to use getPrimaryNavigationFragment() to retrieve the current Fragment.
Apr 17, 2019 at 18:00 comment added Sever All links show how to communicate between fragments. But how we can call fragment method from activity if navigation does not provide any mechanism for getting the implementation of the current destination?
Feb 2, 2019 at 13:46 vote accept BenjaminBihr
Jan 24, 2021 at 14:15
Jun 4, 2018 at 22:25 history answered ianhanniballake CC BY-SA 4.0