Join David Gassner for an in-depth discussion in this video Inserting data into a database table, part of Android SDK: Local Data Storage.
Once you've created your Open Helper and Data Source classes, you can start…adding code to manage your database, including code to insert, update, and delete rows,…and to read data from the database tables. I'll start with inserting data in this project.…I've opened the class ToursDataSource.java, and I'll add a new method to the class that I'll name create.…I'll place this at the end of the existing methods.…It will be public so that it can be called from anywhere in the application and…it will return an instance of my tour class which is in my model package.…
I'll make sure to add the import statement.…The name of the method is create, and it will receive a single argument,…also data type as Tour and named tour.…In order to pass data into the database, you could execute an explicit SQL…statement, but then it's up to you to handle all sorts of coding, including…escaping special characters, using single quotes where you shouldn't be using double quotes, and so on.…Instead, you want to package your values into an instance of a class called…
- 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.