TL;DR: come esporre gli ID delle risorse di ViewModels per evitare di visualizzare dati obsoleti.
// Don't do this public class MyViewModel extends AndroidViewModel { public final MutableLiveData<String> statusLabel = new MutableLiveData<>(); public SampleViewModel(Application context) { super(context); statusLabel.setValue(context.getString(R.string.labelString)); } }
// Expose resource IDs instead public class MyViewModel extends ViewModel { public final MutableLiveData<Int> statusLabel = new MutableLiveData<>(); public SampleViewModel(Application context) { super(context); statusLabel.setValue(R.string.labelString); } }