O'Reilly logo

Android Programming for Beginners by John Horton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Handling the SQLite database

Create a new class called DataManager. We need an SQLiteDatabase object and a whole bunch of final string members for the table and column names.

All the code that we will add first to our DataManager is straightforward, but it is worth pointing out that we will actually have two tables in this database. One called wis_table_photos will have a column for each of the member variables of our Photo class.

Another called wis_table_tags will have just two columns, autoincrement _ID and a tag column.

The wis_table_photos table will have a row of data for each and every photo the user takes. The tags column will only have a row for each new/unique tag that the user enters. So, if the user has more than one photo with the "Barbados" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required