I need some suggestions;
I'm experimenting with Navigation library. I have a fragment which has a webView. I want to check if it canGoBack
and do so if it can, otherwise not interfere.
1. Interface approach: Since Navigation is handling transactions, I don't create an instance of my fragment manually anymore, which I can assign as a listener in activity.
1. Key listening: I really think it looks ugly and I don't think it's a generic solution, so I skip this one.
I need some opinions on how can it be done with Navigation library. When you try to get currentDestination
from navController
, it's NavigationDestination
object which provides information about current fragment, such as label given in xml.
When I inspect fragmentManager
, I see that backStack
is empty & fragment transaction took place without a tag.
IMHO it wouldn't fit the concept of the library to do findFragment
kind of operations to somewhat interact with current fragment, but I can't seem to find a way through with it at the moment. Any suggestions ?