Passing data between Fragments in Navigation Component is easy. Say going from A
to B
you just set arguments
with SafeArgs
and you are done.
But, it gets tricky when passing data from B
back to A
.
According to documentation, we can use SharedViewModel
which is works well. But I am looking for better way of passing data back to A
from B
.
The problem of using SharedViewModel
is, you have to create SharedViewModel
for every fragment pair that you need to pass data.
Any suggestions? If any annotation-processing method you can think about, you are more than welcome to recommend.