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…
![](../../users/profiles/1372195.webp)
Onheiron
- 1,993
- 1
- 23
- 36
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…
![](../../users/profiles/735332.webp)
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…
![](../../users/profiles/10693700.webp)
AaronJ
- 538
- 5
- 13
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…
![](../../users/profiles/1864833.webp)
Jemil Riahi
- 1,260
- 2
- 18
- 34
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…
![](../../users/profiles/4620609.webp)
Samuel Robert
- 7,119
- 7
- 34
- 52
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…
![](../../users/profiles/10104278.webp)
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:…
![](../../users/profiles/4059656.webp)
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…
![](../../users/profiles/5895181.webp)
StayCool
- 205
- 6
- 20
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…
![](../../users/profiles/10451429.webp)
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…
![](../../users/profiles/2390217.webp)
Alireza A. Ahmadi
- 4,234
- 4
- 36
- 57
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 =…
![](../../users/profiles/4593670.webp)
Chickin Nick
- 419
- 5
- 20
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…
![](../../users/profiles/2449549.webp)
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: