android-data-binding | Sample use of Data Binding Library | Data Visualization library
kandi X-RAY | android-data-binding Summary
kandi X-RAY | android-data-binding Summary
Sample use of Data Binding Library
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of android-data-binding
android-data-binding Key Features
android-data-binding Examples and Code Snippets
Community Discussions
Trending Discussions on android-data-binding
QUESTION
I'm using a custom view, com.deadballapp.deadball.ui.pitch.PitchLiveView, but my binding class is unable to access this view. The binding class is able to access cl_pitch_live
PitchLiveView isn't inflated, it's a class that extends View which I'm using to draw to the Canvas so any solution to binding to a custom view I've seen here, here and here don't seem to apply
...ANSWER
Answered 2021-Mar-09 at 02:04This is the alternate method to define custom view in layout xml.
QUESTION
ANSWER
Answered 2020-Mar-29 at 12:11You model is wrong.Try this instead:
QUESTION
Moving from MVP to MVVM and trying to learn from tutorials on web.
Some of the tutorials state that ViewModel classes should not have any reference to Activity or View(android.view.View) classes.
But in some of the tutorials i've seen Views are used in ViewModel class and Activities to start other Activities using ViewModel. For example:
...ANSWER
Answered 2020-Mar-11 at 23:21From the documentation:
Caution: A ViewModel must never reference a view, Lifecycle, or any class that may hold a reference to the activity context.
This is because a ViewModel
survives configuration changes. Let's say you have an activity and you rotate the device. The activity is killed and a new instance is created. If you put views in the viewmodel, then the activity won't be garbage collected because the views hold the reference to the previous activity. Also, the views themselves will be recreated but you're keeping old views in the viewmodel. Basically don't put any views, context, activity in the viewmodel.
Here's a sample from google: https://github.com/googlesamples/android-sunflower/
QUESTION
My problem is that I need to access my LayoutNameBinding, but I am unable to do so. Only DataBinding generated class which is available is LayoutNameBindingImpl.
- Build is successful (No errors)
- DataBinding is enabled within build.gradle(:app)
- DataBinding plugin kotlin-apt is applied within build.gradle(:app)
- My layout is contained within a
- LobbyFragmentBinding.java is generated and contains LobbyFragmentBinding
The commented part is what I would like to be able to do within my code. Part of the code shown is inspired of https://github.com/android/sunflower which explains how to use different parts of Android JetPack.
Solutions tried- Rebuild
- Manually add "import com.kotlin.projet3.databinding.LobbyFragmentBinding"
- Solutions found at android: data binding error: cannot find symbol class (Problem is not the same, but tried anyways)
- Solutions found at Data Binding class not generated (Problem is not the same, but tried anyways)
ANSWER
Answered 2020-Mar-10 at 18:04Bug Tracker https://issuetracker.google.com/issues/151140024
Workaround used (a simpler one probably exists, investigation to pinpoint bug was done afterward)- Copy content of lobby_fragment and LobbyFragment
- Delete lobby_fragment and LobbyFragment
- Create LobbyFragment and lobby_fragment
- Paste copied content
After investigation, the problem seems linked to the way layout files are arranged within my project. I defined extra ressource source dirs within my build.gradle(:app) and when I move my layout files to those folders before doing the first build which would create the generated DataBinding files, the issue within this thread appears.
build.gradle(:app)QUESTION
I'm a newbie for android data binding. I want to bind multiple SeekBars to a collection of float, such as
...ANSWER
Answered 2018-Oct-24 at 07:36Ok, I found the problem: My project does not use Kapt. After add it to build.gradle, all works fine.
QUESTION
I have the same problem as here, but I don’t have enough reputation to ask the author if he could solve it. Can anyone know how to fix this? Android Studio does not see included layout elements. I tried clean project, rebuild project - no helps.
...ANSWER
Answered 2019-Aug-06 at 10:33You should try to build clean project and after that you should try rebuild because this helped me in the past and if that does not work try re-installing your Android-Studio.
Mostly after re-installing android-studio the project will work properly.
You should check following lines maybe that can help you try adding those lines if you are missing it.
build.gradle:
QUESTION
First, I need to acknowledge the clearly very similar but not duplicate issue here. None of the proposed solutions in that thread work.
My application file structure is as follows:
...ANSWER
Answered 2018-Nov-15 at 12:56First try to remove redurant setContentView(R.layout.activity_main);
QUESTION
Basically I am implementing a paint app, so I made a custom View to handle event and draw on canvas. Now I would like to display the coordinate of the points being drawn on a TextView in real time. So I am trying to use a ViewModel with LiveData to do the updating. But I can't figure out a way to give the information from my custom View to the ViewModel. How would you do that ? I also tried to use BindingAdapter but I can't find a way to do that.
Here the code for my custom View:
...ANSWER
Answered 2019-May-20 at 19:36Sorry for sharing this in JAVA... But I guess you can capture the ideia.
On CustomView, create a custom interface:
QUESTION
I am using Android Databinding adapter and it says, it have to be static. So I am trying to make it non static and inject my classes into it with Dagger by following this tutorial. Although I can use my Picasso
instance which is provided by dagger normally in app, it says Picasso cannot be provided without an @Inject constructor or an @Provides-annotated method
.
I add @Inject annotation to my binding adapter constructor but still get same error
...ANSWER
Answered 2019-Feb-13 at 08:51As error said, dagger could not resolve Picasso
dependency. In your case, the problem is that differenct dagger components can use directly only those dependencies, that interface marked with @Component
annotation declared using methods. To allow AppComponent
share Picasso
with BindingComponent
you need modify app component like that:
QUESTION
Following How to set SwipeRefreshLayout refreshing property using android data binding? I'm trying to bind SwipeRefreshLayout
using data binding but SwipeRefreshLayout's progress is not getting hide.
Below is my code that i'm using it:
ViewModel
...ANSWER
Answered 2019-Jan-02 at 09:12I think you should try to update SwipeRefreshLayout
through the SwipeRefreshLayout.post()
method:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install android-data-binding
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page