In this video learn how updates are performed using Realm. Annyce reviews the behavior for both managed and unmanaged objects.
- [Instructor] Realm makes updating your objects easy…by means of its simple API's.…Let's look at an example.…We'll add a new method to the data sources class…and we'll call it modify description.…This method is going to query realm…to retrieve a random recipe,…and then it will set its description.…We can add it here…underneath the getAllRecipes method.…So I'm just going to type public void,…modify description,…and we don't need to accept any parameters for this method.…
The first thing we want to do…is get a managed recipe instance,…and we can do that by using realm's where method.…So we'll call realm.where,…pass in a reference to the recipe class,…and then we'll use the findFirst.…It doesn't matter which recipe we retrieve,…we just want to get one that's managed.…The next that we're going to do…is execute a transaction.…We'll do this by making a call to realm's…executeTransaction method,…and then passing in a new realm transaction.…
Inside of our execute method here,…we are going to modify this managed recipe instance.…
To begin, Annyce Davis reviews using the de facto data persistence solution available on Android: SQLite. She takes you through basic SQLite concepts—such as how to create a database wrapper and insert data into a table—as well as a few more advanced topics. Next, she covers working with Cupboard, an open-source project dedicated to simplifying your SQLite interactions. To wrap up, she dives into working with Realm, an object database solution designed with mobile devices in mind. Throughout the course, Annyce discusses establishing relationships between database tables, creating and running queries, as well as performing data migrations.
- Overview of SQLite
- Defining a database table's schema
- Exploring SQLite create table syntax
- Executing create table statements
- Inserting data with a foreign key relation
- Inspecting the database using a terminal
- Updating and deleting records
- Working with Cupboard
- Working with Realm
Skill Level Intermediate
Android App Development: Unit Testingwith James P White2h 59m Intermediate
1. SQLite Basics
2. SQLite Beyond the Basics
3. Working with Cupboard
4. Realm Basics
5. Realm Beyond the Basics
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take 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.