在对话框中单击“确定”后如何刷新片段

时间:2019-10-04 15:50:36

标签: android android-studio android-fragments

因此,我想在对话框片段中单击“确定”后刷新片段。我该怎么办?

这是我的DialogMap,单击该按钮后单击OK,应重新加载MapFragment。 enter image description here

1 个答案:

答案 0 :(得分:0)

使用NavController导航至该片段

fun refresh(bundle: Bundle) { //->if you don't won't to send a data don't use a bundle 
    navController?.popBackStack() //-> it's because you must delete one step from navigation 
    navController?.navigate(
        R.id.yours_fragment_id,
        bundle
    )
}