Fails videos

Funny videos










LiveData is part of the Lifecycle library which was designed to help you solve common Android Lifecycle challenges and to make your apps more maintainable and testable.

LiveData is a lifecycle-aware observable. LiveData makes it easy to keep what's showing on screen in sync with the data. Benefits include:

* Lifecycle awareness: LiveData works well with the android lifecycle by only sending updates to UI components that are on screen and automatically removing listeners when a UI component is destroyed.
* Can be returned by Room, to learn more about Room →
* Reactive UIs with ViewModel and Data Binding
* Includes basic transformations map and switchMap and MediatorLiveData

LiveData is usually created in a ViewModel class →]

The Lifecycle library includes other classes that LiveData works with, including Lifecycle, LifecycleOwner and LifecycleObservable. To learn more about the Lifecycle library, check out →

Gradle dependencies →

Also take a look:

Room with a View Codelab [LiveData, ViewModel, Room and the architectural guidance] →
Exposing error and loading state via LiveData →
ViewModels and LiveData - Patterns and Antipatterns →
LiveData with SnackBar, Navigation and other events (the SingleLiveEvent case) →
Subclassing LiveData →
Using LifecycleObserver →
Lifecycle codelab →
Guide to app architecture →
Data Binding docs →

Watch more Android Jetpack videos here →

Subscribe to the Android Developers channel here →

#AndroidJetpack #jetpack #featured

  • Robert Chrzanowski
    Robert Chrzanowski Год назад Thanks for the informative video. Keep them coming. Much love for Kotlin.
  • Victor Vicari
    Victor Vicari Год назад How about two-way data binding? How the LiveData approach deals with two-way binding?
  • Sieński Witold
    Sieński Witold Год назад LiveData + databinding is huge help :)
  • Тимур
    Тимур 2 месяца назад A lot of good things about live data, but it's actually very bad. - No normal error handling -- If 'observe' is not used in the 'onCreate' method, then there will be problems when change screen orientation
  • Zhuinden
    Zhuinden Год назад Kotlin's been "officially supported language for Android development" since 2017's I/O, it's been a year, surely we can pick it up by now :D
  • Gabriel Monteiro Fernandes
    Gabriel Monteiro Fernandes 10 месяцев назад Please, provide us a good and complete sample of all of this.
  • Dafle Cardoso
    Dafle Cardoso Год назад Someone has a tutorial how can i use Databinding with recyclerview data?
  • Shreyas Waghmare
    Shreyas Waghmare Год назад (изменено) I've used Databinding with RecyclerView and Live data in this project (JAVA) :
  • Atakan Çoban
    Atakan Çoban 9 месяцев назад Java please :)
  • Mark Scooby
    Mark Scooby 11 месяцев назад You're the best.
  • Dr. Superblazer
    Dr. Superblazer 11 месяцев назад Where can i find the same with java examples?
  • M.Poorvesh Muthraman
    M.Poorvesh Muthraman 9 месяцев назад These are a life saver!!!!!!!!! <3
  • Lim Harry
    Lim Harry Год назад 黄渤…………
  • Tanuj Sareen
    Tanuj Sareen Год назад can ViewModel + LiveData be used in firebase realtime database ??
  • Zhuinden
    Zhuinden Год назад Nobody stops you from posting the latest value to the LiveData when you receive a change notification from Firebase
  • Muhammad Jamal
    Muhammad Jamal Год назад Can LiveData hold many transformations at the same time?
  • Zhuinden
    Zhuinden Год назад Transformations are just doing some magic in the background using a MediatorLiveData, so sure!
  • Henry Marvin
    Henry Marvin Год назад While Kotlin may be a good functional object oriented programming language, a vast majority of android developers are Java developers and among them, a lot of them use Java for other purposes as well. This means that all these people(at least the vast majority) are more familiar with the imperative style of programming rather than functional. It would be rather beneficial for the majority if the sample code in the videos are in Java. A change this fast is quiet difficult to adapt to. Thank You.
  • Sébastien Cayetanot
    Sébastien Cayetanot 7 месяцев назад As developer, we are supposed to be adaptable. We can’t rely on one language and just don’t want to look at something else. In addition, google pushing on kotlin this is why they will use example in kotlin
  • Zhuinden
    Zhuinden Год назад I used to like Java, but Kotlin is better.
  • TZCoder
    TZCoder Год назад I like Java!
  • Kit Mak
    Kit Mak Год назад Imperative programming and OOP, for the most case is good enough to solve many trivial problems, but not being able to model and address some real world problem efficiently. Thats why functional and reactive programming is in trend, because it does help developers solve problems that will be very difficult to solve by a OOP paradigm, which improves ease of maintenance and code readability.
  • Zhuinden
    Zhuinden Год назад Seriously though, you can (and typically do) write imperative code with Kotlin. It's not Elm/Haskell/Clojure/Elixir/Scala.
  • Kane
    Kane Год назад Being pushed to learn something new is not always comfortable.
  • Kane
    Kane Год назад Guys, say ”thank you” to Oracle. It's time to move on to a modern language lol
  • Younghwan Yoon
    Younghwan Yoon Год назад I can't agree more.
  • Kit Mak
    Kit Mak Год назад You can always apply your design patterns implementation in java into Kotlin. These kind of language features are not being enforced to you. like for example you could manually create a singleton with lazy initialization and thread-safety(Hope you do not need to look it up everytime) in Kotlin, while there is an easier way to create it by the keyword object. Along with those language features like null-safety and smart casting, etc. It might not be essential for a very senior java developer since it can be reproduced in java with care, but these features enables the developer to avoid the pitfalls and focus on business logic.
  • Francis Thomas
    Francis Thomas Год назад (изменено) True man. Its like there are FORCING KOTLIN O NTO US.
  • montanax
    montanax Год назад How have you not been using Kotlin for at least a year now. Just lol.
  • Zhuinden
    Zhuinden Год назад (изменено) LiveData is just something that you can subscribe change listeners to. I thought OBSERVER DESIGN PATTERN is a pattern defined in the Gang of Four book which has OOP patterns? Nothing "functional" about it, especially not "inherently functional".
  • hilman shini
    hilman shini Год назад (изменено) true. i cant move from java. tried kotlin but its not suitable for me. i learned so much refactoring techniquewith java, design pattern and anti pattern. but with kotlin it seems weird to use them. and also so many keyword turned to annotations. its confusing for me
  • Gr3nad3_Man1c
    Gr3nad3_Man1c Год назад LiveData is inherently functional, there is no way around that. Kotlin is also far less functional that Scala or Haskell; in fact, I'd say it's closer to Java than to Scala. The Kotlin code in this video is basically Java + some extra syntax sugar.
  • yassine9871
    yassine9871 Год назад They are trying to (force) Java developers to learn and use Kotlin. It's a message from google that Kotlin will be the main language for Android Studio in the next few years.
  • Basanth Verma
    Basanth Verma Год назад Try Kotlin bro! There's no coming back once you're in it ;) Java used to be my love, I've programmed in Java for Android and Spring Boot (And I still do for some of my legacy code). But I've started using Kotlin for both Android and Spring Boot in my new Projects now and it feels awesome! I don't think Google is ever going to return to Java. #KotlinIsTheNewJava
  • Mahendra Rajdhami
    Mahendra Rajdhami 4 месяца назад Thanks.
  • Shreyas Waghmare
    Shreyas Waghmare Год назад (изменено) What would be the java equivalent for the line binding.viewmodel at 1:55?
  • Shreyas Waghmare
    Shreyas Waghmare Год назад Got it! binding.setVariable(BR.myViewModel,myViewModel);
  • baturay Alhaj Ahmad
    baturay Alhaj Ahmad 10 месяцев назад (изменено) //meanwhile == thread, ?
  • Rakesh Kumar
    Rakesh Kumar Год назад Thank you sir
  • Rakesh Kumar
    Rakesh Kumar Год назад OK thank you madam
  • Rakesh Kumar
    Rakesh Kumar Год назад Gordon Foster thank you madam
  • Gordon Foster
    Gordon Foster Год назад Madam.
  • Tobenna Ezike
    Tobenna Ezike Год назад Oh wow kotlin