Managing Android App Data with SQLite

Persistent data storage is at the heart of most modern applications. In this course, you will learn how to use SQLite, the most widely used persistent data storage solution for Android.
Course info
Rating
(33)
Level
Intermediate
Updated
Aug 11, 2017
Duration
4h 28m
Table of contents
Understanding SQLite and SQLite Database Creation
Reading Data from SQLite
Filtering SQL Queries
Connecting SQLite Data to Views with Adapters
Performing Lifecycle Aware Data Loading with Loaders
Doing More with SQLite Queries
Interacting with SQLite Data
Description
Course info
Rating
(33)
Level
Intermediate
Updated
Aug 11, 2017
Duration
4h 28m
Description

SQLite is the persistent storage solution of choice for the overwhelming majority of Android applications. In this course, Managing Android App Data with SQLite, you'll learn how to create Android applications that effectively leverage the persistent storage capabilities of SQLite. First, you'll explore how to create and access a SQLite database in a way that conforms to the standards and best practices of Android app development. Next, you'll dig into the rich query capabilities of SQLite including row selection criteria and row ordering. Then, you'll discover how to use adapters to connect SQLite data to views like RecyclerView, Spinner, and ListView. Additionally, you'll walk through how to perform lifecycle aware queries using LoaderManager and CursorLoader. Finally, you'll learn how to update, delete, and insert data within a SQLite database, including how to maintain a responsive user experience. By the end of this course, you'll have the skills and knowledge to create Android applications of your own that persistently manage data within a SQLite database.

About the author
About the author

Jim Wilson is president of JW Hedgehog, Inc., a consulting firm specializing in solutions for the Android, iOS, and Microsoft platforms. Jim has over 30 years of software engineering experience, with the past 15 years heavily focused on creating mobile device and location-based solutions.

More from the author
Introduction to Xamarin.Forms
Beginner
3h 37m
May 13, 2019
More courses by Jim Wilson
Section Introduction Transcripts
Section Introduction Transcripts

Understanding SQLite and SQLite Database Creation
Welcome to the Pluralsight course, Managing Android App Data with SQLite. This is our first module, Understanding SQLite and SQLite Database Creation. My name is Jim Wilson. The work we'll do in this course will result in another big leap forward for our app. Now currently all our app's data is stored in memory, which means that any changes made to that data are lost when the app is restarted. In this course, we're going to get rid of that issue by transitioning our app to maintain data persistently through the use of the SQLite database API. So we'll start out with just a quick overview of SQLite. We'll then design out the database we need for our application. We'll then see how to express that database design using a convention known as a database contract class. We'll then look into the capabilities of SQLite for describing the capabilities of table columns. We'll look into the considerations for creating the tables within our database so they work effectively with the Android framework. We'll see how to create and access our database. Then we'll finish up by verifying that our database is created just as we expect it to be.

Reading Data from SQLite
Welcome to the Reading Data from SQLite module of the Pluralsight course, Managing Android App Data with SQLite. My name is Jim Wilson. With our application database created, we can start the process of transitioning our app from using transient in-memory data to instead use data that is persistently stored in our SQLite database. In this module, we'll take the first step to making that transition by learning how to read data from our database. We'll start out by taking a look at our initial plan for transitioning the app to use data read from our SQLite database. We'll then see how we issue queries to our database. We'll see how we move through results of our query using something known as a cursor. We'll see how to access the values in our result. And then we'll finish up by seeing how we can control the order that results are returned.

Filtering SQL Queries
Welcome to the Filtering SQLite Queries module of the Pluralsight course, Managing Android App Data with SQLite. My name is Jim Wilson. In this module, we continue our discussion of database queries. What we want to understand now is how to specify selection criteria so that only a subset of rows in the table are returned. So we'll start out with a high-level look at our application plan for this module. We'll see how to specify our row selection criteria. We'll then see how to pass a row selection criteria to the query method. And we'll finish up with a look at how to take advantage of row identity when activities need to communicate with one another.

Connecting SQLite Data to Views with Adapters
Welcome to the Using Adapter to Populate Views with SQLite Data module of the Pluralsight course, Managing Android App Data with SQLite. My name is Jim Wilson. Populating views like spinners, ListViews, and RecyclerViews all rely on our adapter classes. In this module, we'll see how to use adapter classes to populate these types of views with cursor-based data return from a database. We'll start out with an initial look at our application plan for this module. We'll then take a look at the CursorAdapter class and its role in populating things like ListViews and spinners. We'll then see how the SimpleCursorAdapter class simplifies the most common scenarios of populating things like ListViews and spinners. We'll then get into our application code and use a SimpleCursorAdapter to populate the course selection spinner on our NoteActivity. We'll then see what's involved with using a cursor with the RecyclerView. Adapter. We'll wrap up by changing our application to populate the MainActivity RecyclerView with notes queried directly from the database.

Performing Lifecycle Aware Data Loading with Loaders
Welcome to the module, Performing Lifecycle Aware Data Loading with Loaders. This is the Pluralsight course, Managing Android App Data with SQLite. My name is Jim Wilson. In this module, we'll look at the appropriate way to query our SQLite database so we load and access the data in a way that correctly works with the lifecycle of an activity. So we'll start out with a look at how database queries can negatively affect activity user interface performance. We'll then look at the LoaderManager and its role in overcoming those negative effects. We'll see how to load SQLite data using a class known as a CursorLoader. We'll see how to deal with the challenges that come up when an activity needs to load data that comes from multiple queries. And we'll finish up with a discussion of the differences in behavior between initializing and restarting a loader.

Doing More with SQLite Queries
Welcome to our next module, Doing More with SQLite Queries. This is the Pluralsight course, Managing Android App Data with SQLite. My name is Jim Wilson. As we've seen throughout this course, SQLite provides a very rich and powerful data query mechanism. In this module, we'll finish up our discussion of SQLite queries by taking a look at a few additional query-related concepts that we frequently use in our Android applications. We'll start with a look at a concept known as joining tables. Joining tables allows us to issue queries that return back columns from multiple tables. Now joining tables introduce some issues that come up when we access columns by name. So we'll look at those issues next. We'll then look at the role of something called indexes in SQLite queries. And we'll finish up with a look at what's involved in creating indexes.

Interacting with SQLite Data
Welcome to our next module, Interacting with SQLite Data. This is the Pluralsight course, Managing Android App Data with SQLite. My name is Jim Wilson. In this module, we'll see how to modify data within a SQLite database. We'll start out with a look at the fundamental concepts of modifying data within SQLite. We'll then see how to update existing data. We'll see how to insert new data. And we'll see how to delete data. And then we'll finish up with a look at how to interact with database data in a way that doesn't interfere with the activity UI.