I have a ViewModel class, and a Model class in that.
class WorksheetViewModel {
private Worksheet worksheet;
public Worksheet getWorksheet() {
return worksheet;
}
public void setWorksheet(Worksheet worksheet) {
this.worksheet = worksheet;
if (worksheet != null) showButtons();
Logger.E(worksheet.getShort_text());
}
this is working here: Logger.E(worksheet.getShort_text());
and in my xml
<import type="android.view.View" />
<variable
name="viewModel"
type="viewmodels.WorksheetViewModel" />
..
and a textview with:
android:text="@{viewModel.worksheet.short_text + `?`}"
My probleme is, viewModel.worksheet.short_text is allways null. Why?
binding.setViewModel(new WorksheetViewModel());
binding.executePendingBindings();
Also I have all the
Worksheet extends BaseObservable
and
@Bindable
public String getShort_text() {
return short_text;
}
in my Worksheet
?
}" – Clericals