Pass data back to previous fragment using Android Navigation

前端 未结 4 553
天命终不由人
天命终不由人 2021-01-07 21:54

I\'ve started using Android Architecture Components (Navigation and Safe Args, View Models) along with Koin library.

Currently, I\'ve got a problem with passing argu

4条回答
  •  被撕碎了的回忆
    2021-01-07 22:15

    1) Pass string from Fragment A to Fragment B with action_A_to_B and SafeArgs.

    2) popBackStack to remove Fragment B.

    navController.popBackStack(R.id.AFragment, false);
    

    or

    navController.popBackStack();
    

    3) Then pass modified data from B to A with action_B_to_A.

    EDIT.

    Here you have some another solution

提交回复
热议问题