Databinding in Dialog

suggest change

context is an Activity. A dialog needs that activity's window token.

public void doSomething() {
    DialogTestBinding binding = DataBindingUtil.inflate(
            LayoutInflater.from(context), R.layout.dialog_test, null, false);
    Dialog dialog = new Dialog(context);
    dialog.setContentView(binding.getRoot());
    dialog.show();
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents