I am new to the mvvm pattern. I created a ViewModel for the main activity. Now I want to get an instance of the ViewModel in the main activity.
Most Tutorials and answe
I had similar problems and in the end found out I missed off the "extends ViewModel" within the class definition, so it should look like this:
public class ViewModelClass extends ViewModel
{
// Tracks the score for Team A
public int scoreTeamA = 0;
// Tracks the score for Team B
public int scoreTeamB = 0;
}