I tried to find a method in the new Navigation components but I didn\'t find anything about that.
I have the current destination with :
mainHostFrag
From an Activity which has NavHostFragment, below code snippet can be used to retrieve the instance of the Active Fragment.
kotlin
val currentFragment = mNavHostFragment?.childFragmentManager?.primaryNavigationFragment
java
Fragment navHostFragment = getSupportFragmentManager().getPrimaryNavigationFragment();
Fragment currentFragment = navHostFragment.getChildFragmentManager().getFragments().get(0);