I have adjusted my repository to make it a protected variable. Great idea!

The MainViewModel is not required in this example. I included it in order to have a clear separation between the view logic in the Activity and the “Business logic” in the MainViewModel. Per your suggestion, passing in the repository into the MainViewModel; the reason I’m injecting the repository in the MainViewModel is to keep the “Business logic” apart from the UI in the MainActivity.

DeFi Punk

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