Skip to content Skip to sidebar Skip to footer

Android Data Binding Error:execution Failed Java.lang.runtimeexception:

I tried to do some analog of example from here: http://www.mutualmobile.com/posts/using-data-binding-api-in-recyclerview And everything works correct except image url binding. I re

Solution 1:

Found my problem. Instead of:

app.imageUrl="@{item.imageUrl}"

Must be:

app:imageUrl="@{item.imageUrl}"

Solution 2:

Set the argument of BindingAdapter annotation to "app:imageUrl". So you must have this:

@BindingAdapter("app:imageUrl")

instead of this:

@BindingAdapter("bind:imageUrl")

And also what @Alexander Myznikov said - change app.imageUrl to app:imageUrl

Solution 3:

Only try to rename the reference inside of the @BindingAdapter

@BindingAdapter({"bind:image_url"})
    publicstaticvoidloadImage(ImageView imageView, String url) {
        Picasso.with(imageView.getContext()).load(url).into(imageView);
    }

And in your layout this:

...
<data><variablename="item"type="com.example.Item" /></data>
...

<ImageViewandroid:id="@+id/iv_item"app:image_url="@{item.imageUrl}"... />
...

Post a Comment for "Android Data Binding Error:execution Failed Java.lang.runtimeexception:"