So, I implemented
public class DriverLoginActivity extends BaseActivity implements Observer
And, onChanged overided.
In MVVM, the ViewModel is designed to manage data. The ideal way would be handling your API calls in the ViewModel. Using LiveData for this is not the ideal use of LiveData.
Your ViewModel can have
public void onLoginClick(View view) {
//Implement Login API call here
}
public void onRegisterClick(View view){
//Implement Register API call here
}
And in your activity_main.xml
Check this https://github.com/MindorksOpenSource/android-mvvm-architecture/tree/master/app/src/main/java/com/mindorks/framework/mvvm/ui/login