Join David Gassner for an in-depth discussion in this video Retrieving and displaying data, part of Android SDK: Local Data Storage.
Once you've inserted data into a database table, the next natural thing you'd…like to do is retrieve and display it.…I'm working in a new version of the project called RetrieveData.…In this project's datasource class, I already have the code to add new rows.…It's called the Create Method.…And now I'll add code to retrieve all rows and all columns of the same database table.…I'll start at the top of the class.…I'll define a constant which will be an array of strings.…The array will contain one string for each column in the database table.…
I'll create it here as a private static final field, I'll data type it as…String with opening close bracket, which means it's an array, and I'll name it allColumns.…I'll set it using a pair of braces, and then within the braces I'll define…a commented limited list of all of my column names.…The column name constants are in my OpenHelper class.…So I'll start off with ToursDBOpenHelper, and then I'll start with the primary…key column, COLUMN_ID, and I'll add a comma.…
Now I'll duplicate that line of code four times, and then I'll go back and change the column names.…
- 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.