Skip to content

Sync issue - Active tabs - Popup #48

Open
@TheCoderMA

Description

@TheCoderMA

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

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions