Retrieving and displaying data

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.…

Resume Transcript Auto-Scroll

Author

Released

1/25/2013

Take your Android programming skills to the next level with the Android built-in framework that enables local data management in text files and SQLite-based relational databases. This course shows you how to create datacentric apps for Android devices, using SQLite, Java, and the built-in android.database packages. Author David Gassner describes how to define shared preferences, work with JSON and XML files in internal and external data stores, and create new local SQLite databases.