codelab-android-databinding icon indicating copy to clipboard operation
codelab-android-databinding copied to clipboard

error: <identifier> expected when setting up binding adapters for two way data binding

Open asuraphel opened this issue 4 years ago • 0 comments

I am trying to setup two way binding for TextInputEditText with Float variable.

Here is the entire content of my DataBindingAdapters class.

object DataBindingAdapters  {
    @BindingAdapter("android:text")
    @JvmStatic
    fun setText(view: TextInputEditText, value: Float) {
        if(value != view.text.toString().toFloat()) {
            view.setText(value.toString())
        }
    }


    @InverseBindingAdapter(attribute = "android:text")
    fun getText(view: TextInputEditText): Float  {

        return view.text.toString().toFloat()
    }

}

But I am getting:

error: expected float callbackArg_0 = mBindingComponent.null.getText(inputFieldSize);

asuraphel avatar Apr 07 '20 09:04 asuraphel