In order to map your Java class fields to SQLite columns, you will need to define a create table statement. Annyce talks you through this process, step-by-step, in this video.
- [Instructor] Let's start with onCreate.…Notice here on line 18 that we receive an instance…of the SQLiteDatabase class as a parameter.…What we want to do is use it…to provide the queries that we'll need…in order to create our individual tables.…To do this we're going to use the execute SQL method…of the SQLiteDatabase class.…We'll start out by typing db.executeSQL.…
This method takes a string that contains the query…for creating the table.…Let's start with our recipe table.…Instead of defining the string in line here,…we're going to add it to our RecipeContract class.…Remember, we use this class…in order to keep our code neat and maintainable.…So, let's switch back over to RecipeContract.…Right above where we've defined the recipe entry class…we're going to add a new string…that corresponds to our create statement.…
Here on line nine we're going to create…a static final string,…and we're going to call it CREATE_RECIPE_ENTRY_TABLE.…Then we're going to type equals…and we'll type enter to put this on a new line…as this is going to be a very lengthy string.…
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 58m Intermediate
Learning Firebase Cloud Messaging for Androidwith Joe Marini52m 49s 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?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
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.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.