Android studio sending data in between activities

broken image
broken image

ViewModel Life cycle helps us to hold the data and keep that live even if fragment is replaced. ViewModel class acts as an interface between Fragments to sharing data. The ViewModel class is designed to store and manage UI-related data in a lifecycle-conscious way.

broken image

What is viewModel and responsibility of viewModel Let's start with shared viewModel which is the simplest way of sharing the data between fragments/activities.

broken image

So there are multiple ways to share the data between fragments and activities such as In android development, developer multiple time come across a situation where needs to share the data between fragments and activities.

broken image