android-databinding

Navbar appear 2 times when use databinding

时光总嘲笑我的痴心妄想 提交于 2020-01-04 06:26:14
问题 Hi I am trying use the data-bitindng with the navbar for do it I have the next code: MapActivity.java public class MapActivity extends BaseActivity implements NavigationView.OnNavigationItemSelectedListener, OnMapReadyCallback, GoogleMap.OnMarkerClickListener{ private static final float INITIAL_MAP_ZOOM_LEVEL = 17; private static final int INITIAL_REQUEST_CODE = 1; private GoogleMap mMap; private CameraUpdate cameraUpdate = null; private MapViewModel mapViewModel; @Override protected void

access integer array using DataBinding

一世执手 提交于 2020-01-03 16:51:13
问题 I am trying to create RecyclerView with use of DataBinding for Integer data, i have already tried with String data by declaring string-array in string.xml , here is answer from where i have taken reference. Now i am trying to implement it with integer-array but not able to access it from xml. Here is my integer.xml <integer-array name="hours"> <item>1</item> <item>2</item> <item>3</item> <item>4</item> <item>5</item> <item>6</item> <item>7</item> <item>8</item> <item>9</item> <item>10</item>

AndroidX incompatible with DataBinding Android

好久不见. 提交于 2020-01-03 13:55:24
问题 Ok, I've been tasked with migrating a project to AndroidX to reduce the clutter of the support libs in our project. I've enabled AndroidX as per the official docs but now I'm getting run time errors when trying to inflate views via the corresponding auto generated Binding classes that are created from enabling databinding in the modules gradle. Digging into the autogenerated source I came across this method, which is the one which is causing the code to throw: public List<DataBinderMapper>

Dynamically toggle visibility of layout elements with Android data-binding.

三世轮回 提交于 2020-01-03 09:28:51
问题 I am building an Android app, where I want to toggle the visibility of some view elements based on a button click. I am trying to archive it with data-binding instead of using findViewById(), but all the solutions I've have found until now doesn't update the layout, when the variable is changed. Here is what I have so far. (I've simplified the code, to focus on the problem) Activicy.java public class RecipeActivity extends AppCompatActivity { private Recipe recipe; private

Android databinding errors while building

♀尐吖头ヾ 提交于 2020-01-03 07:27:11
问题 I can't build project because of this error. I removed databinding implementation from one fragment and now project doesn't build. I checked carefully layout if I haven't left anything up there. It throws error on Run tasks->:app:dataBindingGenBaseClassesMockDebug->Execute writeBaseClasses I tried so far clean, build project, restart and invalidate caches, reimport project anyway shows same error without any clues whats wrong Parameter 'directory' is not a directory org.gradle.api.tasks

Android Data Binding library - unresolved reference

青春壹個敷衍的年華 提交于 2020-01-02 08:47:32
问题 I am using Kotlin and trying to use new Data Binding Library, but I get unresolved refernce error for xxxBinding classes. Top level build.gradle buildscript { ext.kotlin_version = '1.2.30' ext.gradle_version = '3.1.0' repositories { google() jcenter() } dependencies { classpath "com.android.tools.build:gradle:$gradle_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.google.gms:google-services:3.2.0' // NOTE: Do not place your application

issue with gradle 2.0.0 and DataBinding

不羁岁月 提交于 2020-01-02 05:25:30
问题 Recently i have updated Android studio from 1.5.1 to 2.0, after updation it asked me to use latest gradle i.e. com.android.tools.build:gradle:2.0.0 dependencies { classpath 'com.android.tools.build:gradle:2.0.0' classpath "com.android.databinding:dataBinder:1.0-rc1" } But after updating it is showing error with DataBinding plugin. apply plugin: 'com.android.databinding' //error on this line Error message : Error:(2, 0) Cause: org/apache/commons/lang3/StringUtils Open File I have not used any

RecyclerView generic adapter with DataBinding

大兔子大兔子 提交于 2020-01-02 04:37:07
问题 I have created generic adapter for RecyclerView by using DataBinding. Here is small code snippet public class RecyclerAdapter<T, VM extends ViewDataBinding> extends RecyclerView.Adapter<RecyclerAdapter.RecyclerViewHolder> { private final Context context; private ArrayList<T> items; private int layoutId; private RecyclerCallback<VM, T> bindingInterface; public RecyclerAdapter(Context context, ArrayList<T> items, int layoutId, RecyclerCallback<VM, T> bindingInterface) { this.items = items; this

Android Databinding: “Method references using '.' is deprecated”

 ̄綄美尐妖づ 提交于 2020-01-01 08:02:52
问题 When using databinding in my app, I get the following warning when compiling: Warning:Method references using '.' is deprecated. Instead of 'handler.onItemClick', use 'handler::onItemClick' Please see my XML below. <?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools"> <data> <variable name="handler" type="ClickHandler"/> <variable name="active

Android Databinding: “Method references using '.' is deprecated”

拈花ヽ惹草 提交于 2020-01-01 08:02:30
问题 When using databinding in my app, I get the following warning when compiling: Warning:Method references using '.' is deprecated. Instead of 'handler.onItemClick', use 'handler::onItemClick' Please see my XML below. <?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools"> <data> <variable name="handler" type="ClickHandler"/> <variable name="active