android-databinding

Can't get Root View from Data Binding after enabling safe-args plugin

允我心安 提交于 2019-12-19 08:12:53
问题 I'm working on an Android app using dataBinding and am currently trying to add the safe-args plugin, but after enabling the plugin, I can no longer get the root view via binding.root - Android Studio gives the error: Unresolved Reference None of the following candidates is applicable because of a receiver type mismatch: * internal val File.root: File defined in kotlin.io How can I get databinding and safe-args to play nice together? Note that while the code snippet is in Kotlin I will happily

How to dynamically change view visibility using android data binding

纵然是瞬间 提交于 2019-12-19 07:20:43
问题 I'm trying to achieve one simple view hide/show using data binding. I have an api call and I have to show one progressbar while the api call is going on. Once I get the response have to dismiss this progress and display the data. I tried to change the visibility of progressbar dynamically using data binding. But nothing happens. Only for the first time the progresbar visibility is set according to the binding variable. its not dynamically updating as I update the binding variable. following

android: data binding error: cannot find symbol class

一世执手 提交于 2019-12-18 18:36:54
问题 I am getting started for using DataBinding feature. I am facing problem with it. Error:(21, 9) error: cannot find symbol class ContactListActivityBinding build.gradle(Module: app) apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { applicationId "com.letsnurture.ln_202.databindingdemo" minSdkVersion 15 targetSdkVersion 23 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles

android: data binding error: cannot find symbol class

浪尽此生 提交于 2019-12-18 18:35:03
问题 I am getting started for using DataBinding feature. I am facing problem with it. Error:(21, 9) error: cannot find symbol class ContactListActivityBinding build.gradle(Module: app) apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { applicationId "com.letsnurture.ln_202.databindingdemo" minSdkVersion 15 targetSdkVersion 23 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles

Room annotation processor with Data binding

女生的网名这么多〃 提交于 2019-12-18 11:35:03
问题 I have used Data binding in my existing code and now I am migrating to Room for persistence. I have followed the steps mentioned in Florina's Blog for room My Code builds fine without java code error or BR related error when I remove room dependency annotationProcessor 'android.arch.persistence.room:compiler:1.0.0' and its runs too, but gives Runtime exception saying database_Impl does not exists. As it couldn't generate that's file. But after I put Annotation processor back, it give me Error

Android data binding is not working with <merge> attributes

醉酒当歌 提交于 2019-12-18 02:14:22
问题 I'm trying to use databinding with custom views (a possible usage George Mount showed here). One can't imagine building compound views without <merge> tag. However, in this situation databinding fails: MyCompoundView class: public class MyCompoundView extends RelativeLayout { MyCompoundViewBinding binding; public MyCompoundView (Context context, AttributeSet attrs) { super(context, attrs); init(context); } private void init(Context context){ LayoutInflater inflater = (LayoutInflater) context

How do I use databinding to combine a string from resources with a dynamic variable in XML?

青春壹個敷衍的年華 提交于 2019-12-17 17:36:29
问题 I have a TextView which has a hardcoded string and I have a dynamic variable that I want to put at the end of this string. This is my code: <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:layout_marginLeft="16dp" android:layout_marginRight="16dp"> <TextView android:id="@+id/PeopleName" android:layout_width="match_parent" android:layout_height="match_parent" android:text="@string/Generic_Text"+"@{ Profile.name }" />

What is the recommended way to launch a DialogFragment from a ViewModel?

风流意气都作罢 提交于 2019-12-17 16:36:06
问题 I have a list objects in a Recyclerview . When long-pressing an item I want to show a dialog with data from the item clicked. The Recyclerview is using data binding for each item and I am able to display data from the selected item using Log when long-pressing. When trying to show a dialog, however, you need to get to the Activity , which is not recommended to use in the ViewModel object. So how can I show the dialog? Thanks, Ove 回答1: Conceptually a ViewModel strikes me as the wrong place to

Android in Kotlin: Error in Databinding from the project by Google codelabs

旧巷老猫 提交于 2019-12-14 04:22:02
问题 I was doing this course offered by Google, https://codelabs.developers.google.com/codelabs/kotlin-android-training-data-binding-basics/index.html?index=..%2F..android-kotlin-fundamentals#2, The particular code in github: https://github.com/google-developer-training/android-kotlin-fundamentals-apps/tree/master/AboutMeDataBinding Here I was doing the data binding, which is shown step by step how to implement it. But at the end I was getting an error with ActivityMainBinding I have downloaded

Drawable already belongs to another owner but does not expose a constant state

和自甴很熟 提交于 2019-12-14 00:53:03
问题 Error: Invalid drawable added to LayerDrawable! Drawable already belongs to another owner but does not expose a constant state. I suddenly noticed this error today, and I'm not sure if it was because I just updated my testing device to Android 8.0. The error message clearly states there's something wrong with setting the ripple effect on the floating action button, and indeed there is no ripple effect when the button is pressed. However, I'm not sure what is causing this problem. Actually,