DEV Community

Discussion on: Navigation Component: How to pass data between fragments using Bundle and ViewModel

Collapse
 
harikiran01 profile image
Hari Kiran

Nice article.. clear explanation of code. Have one doubt. in MVVM architecture, can fragments have the responsibility to directly navigate to other fragment, or should the hosting activity take that responsibility of communication between fragments?

Collapse
 
kulloveth profile image
Loveth Nwokike

sorry for the late reply, navigation and communication are two different things so I am assuming you mean communication. if you decide to use viewModel for communication between two fragments then they must be attached to same activity but you can as well use Bundle as an alternative when viewModel is not possible