Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.IllegalStateException: Required DataBindingComponent is null in class FragmentLoginBindingImpl. A BindingAdapter in com.joe.jetpackdemo.viewmodel.LoginModel is not static and requires an object to use, retrieved from the DataBindingComponent. If you don't use an inflation method taking a DataBindingComponent, use DataBindingUtil.setDefaultComponent or make all BindingAdapter methods static. #1

Closed
JeeseC opened this issue Jun 6, 2019 · 1 comment

Comments

@JeeseC
Copy link

JeeseC commented Jun 6, 2019

如题所示,出现了这个问题。
运行程序,点击“Have a account? Login”这个按钮,就报错闪退了。

@mCyp
Copy link
Owner

mCyp commented Jun 18, 2019

抱歉,现在才看到你的问题,是不是LoginModel@BindingAdapter改成这样使用就可以:

    companion object {
        @JvmStatic
        @BindingAdapter("addTextChangedListener")
        fun addTextChangedListener(editText: EditText, simpleWatcher: SimpleWatcher) {
            editText.addTextChangedListener(simpleWatcher)
        }
    }

@mCyp mCyp closed this as completed Jul 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants