can I find a fragment in the backstack with its id...
# android
i
can I find a fragment in the backstack with its id? This:
Copy code
private fun NavHostFragment.hasDestinationInBackstack(destinationId: Int): Boolean {
    for (index in 0 until childFragmentManager.backStackEntryCount) {
        if (childFragmentManager.getBackStackEntryAt(index).id == destinationId) {
            return true
        }
    }
    return false
}
doesn't work, because
id
returns 0, 1, 2... with tag maybe?
a
Copy code
findNavController(R.id.host_fragment)
        .currentDestination?.id == R.id.targetFragment
i
"backstack" ­čÖé