Join David Gassner for an in-depth discussion in this video Managing the database with a DataSource class, part of Android SDK: Local Data Storage.
Once you've created your Database Open Helper class, the next step in…following the best practices for managing SQLite is to create another class called a data source.…Its methods, the data sources methods, will be called by the rest of the app.…You can create multiple data sources in an application.…For example, you might create one data source for each table in a database or…one data source for each set of tasks. How you architect that is up to you.…In my example, I only have a single table right now, so I'll use a single data source class.…
I'm working in a version of the project named data source…that already has a Database Open Helper class named ToursDBOpenHelper, and right now…its methods are being called directly by the main activity.…I'll create a new data source class, and I'll put it in the same package as the Open Helper.…I'll right-click on the .db package and I'll create the new Java class and I'll name this ToursDataSource.…Data source classes don't extend any particular Superclass.…
In fact, my data source class won't have an explicit Superclass at all.…
- Exploring local data storage options
- Creating an Android virtual device
- Starting a new project
- Defining preferences with Java and activities
- Creating and reading JSON and XML data files
- Creating a new SQLite database
- Inserting and retrieving data in the database
Skill Level Intermediate
1. Getting Started
2. Using Application Preferences
3. Using Internal and External File Storage
4. Working with SQLite Databases
5. Managing and Displaying SQLite Data
Improving the data display9m 29s
- 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.