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

1
  • Do you have code for this solution? Commented Mar 7, 2019 at 11:30

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.