This is a good article for that usecase but there are apps (specially shopping carts) that follow a flow on each page, and that flow has to be stateful.

I recommend using something like Flux architecture to have the state in viewmodel there (like Mobious Library by Spotify).

For each usecase, you have a state in your viewmodel, but the difference with your approach is that the state itself is non-null and also immutable. when actions come from somewhere (like ui), the current state might change (by a usecase) based on the current state, and the change is propagated to the view.

--

--

Android Team Lead at Tapsi

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store