Тёмный
No video :(

Fun with LiveData (Android Dev Summit '18) 

Android Developers
Подписаться 1,3 млн
Просмотров 104 тыс.
50% 1

LiveData is a simple observable data holder that is aware of the lifecycle of the observers. It was designed to avoid memory leaks and null pointer exceptions between an activity or fragment and a ViewModel.
However, you can also use LiveData beyond the ViewModel. Components like Room or Workmanager also expose LiveData observables, and you can make your own data sources lifecycle-aware.
In this talk, we'll deep dive into patterns with LiveData such as the different types of transformations (map, switchMap and MediatorLiveData), handling events and building reactive architectures as well as common antipatterns and code-smells to avoid.
Links:
LiveData blogs → bit.ly/2PUpnWd
Samples → bit.ly/2qzKbDN
I/O app → bit.ly/2Ov1Vd3
Presented by: Jose Alcérreca & Yigit Boyar
Android Dev Summit '18 all sessions playlist → bit.ly/ADS18-Se...
Subscribe to the Android Channel! → bit.ly/AndroidD...
#AndroidDevSummit" event: Android Dev Summit 2018; re_ty: Publish; product: Android - Jetpack; fullname: Jose Alcérreca, Yigit Boyar;

Опубликовано:

 

6 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 58   
@sleepydev4700
@sleepydev4700 3 года назад
what does it mean by creating live data every time, so basically it's not a good way to have a field of livedata in repository?
@ioanesharvadze707
@ioanesharvadze707 5 лет назад
Very good points in this talk! It's interesting to see when one can use Coroutines Channel API and when LiveData.
@mr.w483
@mr.w483 4 года назад
Love the opening song, might I have its name :D
@dipeshmalkar6046
@dipeshmalkar6046 4 года назад
I think library like room should not provide support to LIVE DATA as return type. As most of the time developer use them with viewmodel where lifecycle doesn't matter. A simple observer pattern design would be good enough
@hugovera1540
@hugovera1540 Год назад
they like to make it as harder and convoluted as possible.
@otischen8773
@otischen8773 5 лет назад
Subtitle says "If you try to scale, it is just not going to work" at 18:18. Is that means livedata can not handle UI very well when the scale is big?
@JoseAlcerreca
@JoseAlcerreca 5 лет назад
Yeah, LiveData was designed for View-ViewModel. Transformations were added for simple combination of LiveDatas. If you are trying to combine dozens of data sources with different lifespans you might to look at something else.
@Zhuinden
@Zhuinden 5 лет назад
What? No, by scaling they meant that "scaling it beyond the responsibility it was designed for", namely holding the last value and providing it to the observer (Activity/Fragment). So like, don't try to model network requests with LiveData with some kind of LiveDataCallAdapter because why would you even do that
@mdalikazi
@mdalikazi 5 лет назад
Very good summary of the new MVVM!
@user-kj1vp1tt9u
@user-kj1vp1tt9u 3 года назад
Is the end telling us that ,we don't need use the livedata to in reposity to convert data ?
@b.k4142
@b.k4142 5 лет назад
Hi every one i don't understand transformation map switch it s behind the scene what happened in android studio! thanks
@aravindhanathmanathan2489
@aravindhanathmanathan2489 3 года назад
Please ..Anyone can me explain the Transformation.swtichMap?
@laujimmy3866
@laujimmy3866 4 года назад
@3:22 it's not in an active state, like a onStop
@BoobalanMunusamy
@BoobalanMunusamy 4 года назад
I don't understand why Google making observable so complicated using LiveData and etc.. Look at C# WPF , how easily they were implemented this MVVM pattern. Even Xamarin supports such a observable design pattern without any hurdle. But, Google is messing this up with many complicated API. How this ViewModel works with Databinding concept ?
@emmanuelmtali1594
@emmanuelmtali1594 4 года назад
You can pass your ViewVodel to your DataBinding object on your Activity/Fragment. In your layout you can access public function or variables of your ViewModel you just passed including the LiveData
@witoldsienski1709
@witoldsienski1709 5 лет назад
Complete presentation :)
@damolaOnikoyi
@damolaOnikoyi 2 года назад
thank you for this
@bessermt
@bessermt 4 года назад
15:20 Why would observers be able to change something that is immutable?
@mochadwi
@mochadwi 4 года назад
maybe he meant, "the observer can't change it"
@RaulGerardoHuertasPaiva
@RaulGerardoHuertasPaiva 2 года назад
this was supposed to be fun... :P
@tarrymasters1242
@tarrymasters1242 5 лет назад
So simply I got confused. If only a written text or a step procedure for tose of us whot are required to set up for the program on a seperate page, which hearing or language program to allow viewing every page.
@mujtabac5
@mujtabac5 5 лет назад
You can imagine now how things can get so confused on a job interview when someone confuses exactly the same way these two nerds just did. Typical Google interviewers!
@jazzthechamp2105
@jazzthechamp2105 5 лет назад
Helloo i have one question., What is the need of ViewModel if we can handle configuration changes by writing a single line of code in manifest file i.e configurationChanges”orientation|keyboardHidden”..
@HaiderAli-co9jl
@HaiderAli-co9jl 5 лет назад
That's not recommended, you can look at the android docs. ViewModel is the part of the well accepted android architecture and code is more organized and debugable (don't know if it's a word or not ;) ).
@MrLeeKnees
@MrLeeKnees 4 года назад
Because there are lots of ways the system can destroy your activities apart from device rotation, etc.
@devdeeds
@devdeeds 3 года назад
Thank you
@anirudhganesh7714
@anirudhganesh7714 4 года назад
shows 4 lines of code and calls it simple. Me the noobie watches and blinks
@derickflorian4724
@derickflorian4724 3 года назад
I'm sure you figured it out by now, Anirudh, but I'm struggling to learn this concept! This video was extremely helpful though and hopefully I'm a little closer to grasping it.
@mostasimbillah
@mostasimbillah 5 лет назад
How can I get the slide?
@kattaritechnologies1592
@kattaritechnologies1592 2 года назад
2:58 the second guy contradict the first guy, and he runs in shame.
@tarrymasters1242
@tarrymasters1242 5 лет назад
We are always developing.
@senab
@senab 5 лет назад
Always.
@MuhammadAmir-mf9xt
@MuhammadAmir-mf9xt 5 лет назад
that awesome..
@linuxhai
@linuxhai 5 лет назад
LiveData
@JoseAlcerreca
@JoseAlcerreca 5 лет назад
LiveData! 👍
@ruif3r
@ruif3r 4 года назад
LiveData
@jaiminmodi2027
@jaiminmodi2027 3 года назад
Lovely Live Data !!
@tarrymasters1242
@tarrymasters1242 5 лет назад
The Android is a tool?
@jaiminmodi2027
@jaiminmodi2027 3 года назад
No.
@technics6215
@technics6215 Год назад
Lol it was in 2018 and there is still findViewById and that guy who was talking about studying computer science to type "findViewById" :D
@mukund_kn
@mukund_kn 5 лет назад
They are using Kotlin everywhere. I get that because they provided the first class support. But that doesn't mean to ignore the Java right? I am a Java developer and when they use Kotlin tool for explaining stuff, I get bored. I just don't understand the flow of Kotlin, it's just not easy to read. At least they should use both Java and Kotlin in these kinds of presentation. So many peoples are still depending on Java and Google should not act like they don't care about Java developers.
@Zhuinden
@Zhuinden 5 лет назад
Kotlin fits much better on slides, it's easier to just learn how to read Kotlin.
@KyleFalconer1
@KyleFalconer1 5 лет назад
Google has said (as of 2019) that they're going to be using Kotlin as the primary language for Android. You should expect this going forward. It's not going away.
@abdusalam3ar
@abdusalam3ar 5 лет назад
Totally agree. We have to learn kotlin now in order to understand what they are talking about. There is even new code labs that are only in kotlin
@mrarcticaaa1101
@mrarcticaaa1101 4 года назад
Kotlin is quite easy and google has free courses on udacity, even for those with java background since it's easier for them.
@pxnx
@pxnx 4 года назад
Kotlin is much better and simpler. Why keep on Java?
@SnoopyDoofie
@SnoopyDoofie 5 лет назад
Stick with RxJava.
@AryanKumar-no5jf
@AryanKumar-no5jf 5 лет назад
LiveData is a data holder, it's not for advanced business logic.
@tarrymasters1242
@tarrymasters1242 5 лет назад
Developers where else are we, me or I?
@jaiminmodi2027
@jaiminmodi2027 3 года назад
you r master
@watfordjc
@watfordjc 5 лет назад
Telling me loaders are deprecated, and then only using Kotlin to try and explain LiveData, means I can't comprehend LiveData. I will never understand Kotlin because it removes all the syntax and clues my ASD brain needs to work out what code is doing, meaning unlike C, Java, JS, C#, Python, PHP, etc. I cannot make any sense of what the meaningless gibberish on the slides is trying to describe. Use pseudocode in your next talk if you think the subject is important enough to be understood by all, because Google has done a crap job at explaining why l should no longer use an AsyncTaskLoader to load JSON over HTTPS that must *not* be stored or cached.
@Existentialkev
@Existentialkev 5 лет назад
Wow... 1st Kotlin is not complicated at all, give it the good ol' college try. Hearing you complain about it lack the useless verbosity of Java shows me you haven't given it a fair chance. 2nd Jesus H Chris if you are still using AsyncTask to handle IO operations you are years behind on android best practices... Please do some googling and you will find possibly hundreds of articles about why you should ditch AsyncTask If you are actually a professional android developer and harboring these views, I might have a heart attack
@kolboch
@kolboch 5 лет назад
@@Existentialkev You are wrong there cowboy. If you think that everyone works with start up projects and can easily use fresh 1 month old tech stack you are very wrong, don't attack this guy because of async task, maybe he can't add 5Mb of libraries just to make single api call... Please respect other, there are many different situations and you shouldn't judge just from your perspectives. About Kotlin I agree though, pause the video Watford and you will see it's the same like java, just more simple and elegant to write what you want if done properly ;)
@DriveToSuccessTalks
@DriveToSuccessTalks 2 года назад
@@kolboch right 👍
@tarrymasters1242
@tarrymasters1242 5 лет назад
google is attempting me to upgrade for my photos, for a profit most are those I had received from you tube, i am only taking a few photoes and had not descivbed theem.
@kassadinorz9855
@kassadinorz9855 5 лет назад
the library has million transformations means ?
@mightyfinner
@mightyfinner 5 лет назад
I guess he was referencing Rx transformations
Далее
Android Suspenders (Android Dev Summit '18)
37:04
Просмотров 31 тыс.
3d printed demon core vs real
00:24
Просмотров 7 млн
How to Learn Python FAST with ChatGPT?
8:05
Просмотров 1 млн
Get animated (Android Dev Summit '18)
39:36
Просмотров 109 тыс.
Understand Kotlin Coroutines on Android (Google I/O'19)
37:49
Unix vs Linux
13:59
Просмотров 1,6 млн