I am trying to understand how MVVM works. Here are two examples (in Andrdoid) on how I understand it should work, please tell me if I understood correctly.
I currently want to make a list of radiobutton "Sex" with currently two possible values (Male, female). I expect it to change to "Gender" and three possible values (Male, female, other). I have the label as a TextView in my View that references the 'label' field of my viewModel. The label of my view model itself is referencing a field of my Model. Right ? Also I should write the view as able to print a list of radio buttons from a table. That way, if I add a sex/gender, the View does not have to change. What I am wondering is where this list "Male, Female" should be stored. Is it in the ViewModel or is it in the Model ? If this list is stored in a database, who should extract it ? The ViewModel or the Model ?
I have a "new password" field. The password have to respect certain conditions (length, special numbers...). How are those condition checking handled ? The View will contain the EditText field password. When the user types the password, the view calls the ViewModel which itself will call the Model to check. If the password doesn't fit, the model will return one or more warning values (length_too_short, no_special_char), the viewModel will then translates those warnings ("The password has to be 8 characters minimum", "At least one special character") and will call the View to show password error (the password field becomes red and under it the view writes the error message it receives).
Thank you in advance for your help