Questions tagged [android-databinding]

Data Binding Library to write declarative layouts and minimize the glue code necessary to bind your application logic and layouts. The Data Binding Library offers both flexibility and broad compatibility — it's a support library, so you can use it with all Android platform versions back to Android 2.1 (API level 7+).

The Data Binding Library offers both flexibility and broad compatibility — it's a support library, so you can use it with all Android platform versions back to Android 2.1 (API level 7+).

To use data binding, Android Plugin for Gradle 1.5.0-alpha1 or higher is required.

Official API Documentation

Data Binding Guide

2508 questions
1
vote
1 answer

Android ObservableBoolean not triggering View.setVisibility every time

I have a ViewModel that aims to control the state of an Activity or a Fragment. This ViewModel contains 4 ObservableBoolean that are used inside my layouts to tell which view has to be visible or not: public class ContentLoaderViewModel extends…
MHogge
  • 5,408
  • 15
  • 61
  • 104
1
vote
1 answer

How to data bind a nested button inside a mapFragment

I am trying to bind a button which i have put inside a MapFragment I want my map to have a button which acts like a menu button this is my fragment public class MapFragment extends Fragment implements OnMapReadyCallback, …
1
vote
2 answers

Passing data via intent in android

I have 5 activities, say activity A,B,C,D and E. Each activity has two buttons yes & no,buttons have the data which I want to pass to activity E only. I need to do following things: --> When user press yes/no button of A_activity, the user move to…
1
vote
0 answers

Android Databinding onClick() not getting registered on a simple View

I am trying to call a method from my ViewModel through data binding, but the method isn't called. This is how the view looks:
bogdanN
  • 183
  • 10
1
vote
1 answer

Getting error: package com.mydomain.databinding does not exist when building multi-module project and class with databinding as generic type

I have a multi-module project where I set my databinding classes as a generic type requirement: public abstract class BaseActivity { //Rest of the code... } However, if I extend this activity on a submodule,…
ADev
  • 5,259
  • 2
  • 16
  • 29
1
vote
1 answer

Can I "bind" an image file to an ImageView?

I have an Android app that contains a users list with an Avatar for each user. The avatar image file is stored as a local .png file in the apps cache folder. From time to time, another service updates the avatar png files with more current ones (but…
Brett
  • 11,637
  • 34
  • 127
  • 213
1
vote
3 answers

android data binding colors from resources

Is it possible to reference colors from xml using databinding for android? This works fine: android:textColor="@{inputValue == null ? 0xFFFBC02D : 0xFFFFEB3B}" but this does not: android:textColor="@{inputValue == null ? @color/red :…
Frank
  • 12,010
  • 8
  • 61
  • 78
1
vote
1 answer

databinding with RecyclerView where each item CheckBox

I have RecyclerView ,where each item represents, CheckBox and EditText when clicks on CheckBox the text of EditText should strike through, I have ObservableBoolean which is article.complete I used it in…
I.S
  • 1,904
  • 2
  • 25
  • 48
1
vote
0 answers

Item In RecyclerView doesn't get bind correctly after notifyItemChanged call

My RecyclerView displays a range of days like seen below. At first, everything is working as intended (dates, color, abbreviation, and transparency are set correctly). When I press one of the circles below the data of the centered day is supposed…
1
vote
1 answer

How to use proguard with data binding (proguard.ParseException in aapt_rules.txt)?

I enabled proguard for my project and got the following error: 01:25:13.221 [ERROR] [org.gradle.BuildExceptionReporter] > java.io.IOException: proguard.ParseException: Expecting opening '(' or separator ';' before '{' in line 147 of file…
Equidamoid
  • 1,447
  • 1
  • 13
  • 24
1
vote
1 answer

Change Item style of Recyclerview with Data Binding

I have a recyclerview and i want to change the style of each item of the recyclerview with databinding dynamically. This is my Recyclerview item layout
hushed_voice
  • 3,161
  • 3
  • 34
  • 66
1
vote
3 answers

Android layout databinding won't work

I try to dynamically hide/show an element in my views, therefore i followed this example Dynamically toggle visibility of layout elements with Android data-binding. I use Android Studio 2.3.1 compileSdkVersion 23 buildToolsVersion…
wutzebaer
  • 14,365
  • 19
  • 99
  • 170
1
vote
2 answers

Android Is it possible to show / hide views using view variables

Is it possible to show / hide views depending on values from same XML? I don't want to write many conditions to java file. What I mean is; if we can do this
Mohamed
  • 1,251
  • 3
  • 15
  • 36
1
vote
2 answers

Android Data Binding pass arguments to onClick with lambda expression

I have an imageView with image loaded in it, and i want to open full screen activity with this image.
ZolkiBy
  • 123
  • 1
  • 7
1
vote
2 answers

cannot resolve MainActivityBinding and also binding related issues

I want to make a scientific calculator. I found some useful code on this site: http://www.androidauthority.com/build-a-calculator-app-721910/ Then i modified it for my purpose. In this code i found binding method was used so i made the following…
1 2 3
99
100