Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync issue - Active tabs - Popup #48

Open
TheCoderMA opened this issue Jun 24, 2023 · 0 comments
Open

Sync issue - Active tabs - Popup #48

TheCoderMA opened this issue Jun 24, 2023 · 0 comments

Comments

@TheCoderMA
Copy link

TheCoderMA commented Jun 24, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant