Observables can be individual fields or entire class objects. In this video, learn the difference between observable fields and classes and how to use each.
- [Instructor] In this example, … we're going to take our existing, … simple data model and make it observable. … So that changes to the data are reflected in the layout. … So let's open the observable weather data class … here in our editor. … And we can see that this is a data class, … just like our simple example, but in this case, … the fields are observable data types. … So we have observableInt for the temperature … and the windchill … and observable field of type string for the conditions. … Let's also open up the observable fields activity, … and we have some code that's similar to these simple … example, but we just need to add our modifications. … So first I'm going to instantiate an object of the … observable weather data class. … So I'm going to make a private value called obs_weather. … And that going to be equal to … a new observable weather data object. … And then I'll pass in some values for the fields, … so I'll pass an observableInt, … and we'll have 30 degrees for the temp …
Author
Released
11/19/2020Skill Level Intermediate
Duration
Views
Related Courses
-
Android App Development: Communicating with the User
with Joe Marini1h 19m Intermediate
-
Introduction
-
What you should know1m 14s
-
Getting set up1m 37s
-
1. Overview
-
What is data binding?1m 51s
-
Doing things the old way4m 2s
-
Setting up your project1m 19s
-
-
2. Basic Data Binding
-
Create binding layout5m 13s
-
-
3. Layout Expressions
-
4. Binding to Observable Data
-
Overview of observables1m 51s
-
Binding to observables4m 49s
-
Binding to ViewModels6m 25s
-
Using binding adapters7m 19s
-
Two-way binding syntax4m 45s
-
Using converters4m 2s
-
-
Conclusion
-
Next steps1m
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Binding to observables