-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Labels
bugSomething isn't workingSomething isn't working
Description
I modified little code like this. The only thing I change is when user press back button, instead of closing application, I'm finding and providing start destination. The thing is redirection works fine, screen is also changing, but tabs are not changing!
Code:
private fun navigateToDestination(navController: NavController, itemCbn: Model) {
if (itemCbn.destinationId == -1) {
throw RuntimeException("please set a valid id, unable the navigation!")
}
val builder = NavOptions.Builder()
.setLaunchSingleTop(true)
.setEnterAnim(R.anim.fade_in)
.setExitAnim(R.anim.fade_out)
.setPopEnterAnim(R.anim.anim_slide_up)
.setPopExitAnim(R.anim.anim_slide_down)
// pop to the navigation graph's start destination
builder.setPopUpTo(findStartDestination(navController.graph).id, false)
val options = builder.build()
try {
//navController.popBackStack()
navController.navigate(itemCbn.destinationId, null, options)
} catch (e: IllegalArgumentException) {
Log.w("TAG", "unable to navigate!", e)
}
}
Kindly help ASAP.
Troubleshooting: I tried to call show() from destination listener but it is not helping expected way. If you're not getting time to write the code, just guide me for the solution and I'll do it for you.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working