use of com.liangfeizc.databinding.model.User in project MasteringAndroidDataBinding by LyndonChin.
the class ViewStubActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mBinding = DataBindingUtil.setContentView(this, R.layout.activity_view_stub);
mBinding.viewStub.setOnInflateListener(new ViewStub.OnInflateListener() {
@Override
public void onInflate(ViewStub stub, View inflated) {
ViewStubBinding binding = DataBindingUtil.bind(inflated);
User user = new User("liang", "fei");
binding.setUser(user);
}
});
}
use of com.liangfeizc.databinding.model.User in project MasteringAndroidDataBinding by LyndonChin.
the class BasicActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityBasicBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_basic);
User user = new User("fei", "Liang", 27);
binding.setUser(user);
}
use of com.liangfeizc.databinding.model.User in project MasteringAndroidDataBinding by LyndonChin.
the class IncludeActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = DataBindingUtil.setContentView(this, R.layout.activity_include);
binding.setListener(this);
binding.setOkText("to toast");
//in order to get the etName, you must define an id for the include tag.
binding.layoutInput.etName.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
User user = new User(s.toString(), "Liang");
binding.setUser(user);
}
@Override
public void afterTextChanged(Editable s) {
}
});
}
Aggregations