Questions tagged [android-binding-adapter]

92 questions
26
votes
1 answer

Android data binding ObservableList behaviour issue

I find it hard to spot the real raison d'etre of the android.databinding.ObservableList as a data binding feature. At first it looked like a cool tool to display lists, through data binding, adding them via xml to a RecyclerView. To do so, I made a…
16
votes
1 answer

Android BindingAdapter order of execution?

I need to understand how the Data Binding Library determine the order of execution for its BindingAdapters. If I have two BindingAdapters for a View and if the View has both the attributes corresponding to those BindingAdapters, how will it…
chaser
  • 2,837
  • 3
  • 23
  • 33
15
votes
1 answer

Android Data Binding: Missing return statement in generated code when calling custom binding adapter more than once

I am using the android data binding library and MVVM architecture. In the xml layout I define a variable named viewModel of type myViewModel. The layout has several TextInputEditText for which I used the following custom binding adapter: //makes the…
14
votes
4 answers

Binding Adapter not working properly

I have a hard time making @BindingAdapter to work in my project. @BindingAdapter("imageUrl") public static void setImageUrl(ImageView imageView, String url) { Log.d("TEST","URL: " + url); } Above code shows how it is implemented in my…
9
votes
1 answer

How provide default value in BindingAdapter method in DataBinding Android

I'm working on a binding adapter method to set color span in TextView. @BindingAdapter("foregroundColorSpan", "start", "end", requireAll = false) fun TextView.setForegroundColorSpan(color: Int, start: Int = 0, end: Int = text.length - 1) { val…
7
votes
4 answers

Android - Binding adapter not working

I have create a binding adapter to display picture with picasso, but it doesn't work. I have the following error : Found data binding errors. ****/ data binding error ****msg:Cannot find the setter for attribute 'app:loadPicture' with parameter…
MLabar
  • 373
  • 4
  • 11
7
votes
1 answer

Databinding bindingadapter with multiple parameters not working

I´m trying to use databinding for loading an image with Glide, Imageview and Bindingadapter with multiple parameters: @BindingAdapter(value = ["url", "defaultImage", "placeholder", "circleCrop"], requireAll = false) fun ImageView.setImageUrl(url:…
Lemao1981
  • 1,907
  • 2
  • 16
  • 25
6
votes
1 answer

How to create Binding Adapter for material.Slider view?

My goal is to 2-way databind material.Slider view to MutableLiveData from my viewmodel: Of course, it's not working because there…
6
votes
3 answers

BindingAdapter LiveData first value always null

I'm trying to handle a LiveData value (profilePicture: Bitmap) within a BindingAdapter function but the first value is always null. The binding adapter is a ViewSwitcher with ProgressBar and ImageView. Getting profile picture from firebase like…
Erkan
  • 105
  • 1
  • 8
6
votes
3 answers

Two way binding on custom view

I have a componed view in android contains several textViews and one EditText. I defined an attribute for my custom view called text and getText, setText methods. Now I want to add a 2-way data binding for my custom view in a way its bind to inner…
6
votes
3 answers

Data binding adapter. How to get view by id reference?

I want to specify view reference as atribute to ImageView @BindingAdapter(value = {"imageUrl", "progressView"}, requireAll = false) public static void setImageUrl(ImageView imageView, String url, @IdRes int progressBar) { Context context =…
5
votes
3 answers

Why is this BindingAdapter not working in Kotlin?

I have a ViewModel with: val imageUrl = ObservableField() My layout XML has: I have a BindingAdapters file with a top level function: @BindingAdapter("url") fun…
SilentByte
  • 968
  • 8
  • 17
5
votes
1 answer

Set via Data-Binding API a well known attribute value

I have an custom attribute from a custom view defined line this: