首页 > 解决方案 > 如何从通知片段中打开正确的指定名称选项卡?

问题描述

我是初学者开发者 android,我希望我的通知片段导致正确的名称选项卡位置我的参数在 rest val tab_approval_type:String 我的参数选项卡批准包含 3 个参数:加班、休假、许可,我的选项卡包含一个片段中包含的 3 种类型,我的名字选项卡:加班,请假,允许我想要这个结果示例我从通知片段单击允许,然后参数显示选项卡允许。 现在我点击后的通知不显示正确的标签

my code like this in fragment notification
private fun navigate(type: String) {
        if (findNavController().currentDestination?.id == R.id.notificationFragment) {
            when (type) {
                "Approval" -> findNavController().navigate(NotificationFragmentDirections.navigateToApproval())
                
            }
        }
    }

how to fix this? thank you

标签: androidandroid-studiokotlin

解决方案


推荐阅读