📗 Get the code written in this tutorial 👇👇
https://resocoder.com/data-binding-livedata
Start saving time now by planning weekly with Week Sweep: http://bit.ly/2Jf3QA0
Managing the layout programmatically can be quite time consuming and verbose on Android. Even though Kotlin spares you of calling findViewById, accessing views in the activity code can still get ugly. When you use data binding, you can do most of the UI related stuff right in the XML layouts.
With LiveData, data binding becomes even more powerful and simple to use. While you could create observable fields even in the past when LiveData didn’t exist, this new life-cycle aware observable makes data binding even better and simpler.
In this tutorial you are going to learn how to use one-way and two-way data binding with LiveData and MVVM architecture.
Go to my website for more information, code examples and articles:
● http://resocoder.com
Follow me on social media:
● https://www.facebook.com/resocoder
● https://twitter.com/resocoder
source
Is it even needed to use databinding while using kotlin? Woopsies, ur vid description answers my questions
Hi , I have just one doubt , if we have a dataclass having 2 field name and address and that is intialised with Live data then how can we achieve 2 way binding for that,
Great tutorial
THANK YOU VERY MUCH!!!!!!!!
how to read ImageView from ViewModel?
Pro tip: play the video in 1.25x speed!
The way of writing databing related code in the video is over complicated. 5:47 / 32:04
Thanks for making this video. You explain this concept excellently! Just perfect.
Great tutorial, thank you
Good Tutorial but i got an error illegal character at index 0 android
i can't next step in type="com.resocoder.databinding.MainViewModel" why??? can help me 🙁
This does not work for fragments
thank you and autosubscribe after watch this excellent tutorial
Clear and concise tutorial, thanks from Brazil!
Great tutorial , 2w binding is awesome
Great tutorial.Thanks for the help .
Thanks for the information about MutableLiveData for two way data binding.
which theme you are using
been struggling for this thing for days. missing .value and now it work. thanks
Hi, could you please help me. When I try to bind mutablelivedata-string variable it works fine and I can observe any changes in the activity, however, when I try to bind mutablelivedata of custom model type, I am unable to observe any change to the value of the custom model attribute in my activity.
Greeting from Russia! One of the best tutorials I have ever seen!!! The best wishes!
Hello, thank you for a great video on data binding. Could you please tell me what Theme you are using, I really like it.
its work but its not perfect
I like your explanation style. I couldn't quite get the repository to build, but I was able to transplant the code into another project and run it. I watched quite a lot of videos on two-way binding and read a lot of tutorials, but yours was the clearest and had code I could use. I'll be looking for other topics, like recycleview with databinding, preferably in Kotlin.
Remove @Bindable from ViewModel's MutableLiveData field. It's redundant and causes compile time exceptions.
You're holding on to the same state – currentRandomFruitName – in two different places while trying to synchronise between them. There should be a law against that.