Hi I am developing android application in which I am using I am using single Activity and 3 fragments. So consider I have 3 fragments A B C. When I switch from A to
I use this way, add this block code in your fragment
requireActivity().supportFragmentManager.addOnBackStackChangedListener {
val fm = requireActivity().supportFragmentManager
fm?.let {
if (it.backStackEntryCount == YOUR_FRAGMENT_BACK_STACK_INDEX) {
// your fragment visible
}
}
}