6

I have two fragments (eg. Fragment1,Fragment2), I can use

Navigation.findNavController(v).navigate(R.id.action_fragment1_to_fragment2, args);

fragment2 can get the args by safeArgs

but how can I get the data that the fragment2 want to send back ?

the NavController don't have the method such as navigateForResult()

when Navigation.findNavController(v).navigateUp() in fragment2;

how can i get the data from the fragment2 use Navigation Component?

wait a moment

I thought one way to send back

set a action popTo fragment1 with bundle contains data

then can receive the new data from fragment2

0 Answers0