Android and SQLite using the SQLiteOpenHelper

Posted by tunneling on Stack Overflow See other posts from Stack Overflow or by tunneling
Published on 2010-06-09T01:47:14Z Indexed on 2010/06/09 2:52 UTC
Read the original article Hit count: 320

Filed under:
|
|
|

I have a SQLite database, and several tables within that database. I am developing a DBAdapter for each table within the database. (reference Reto Meier's Professional Android 2 Application Development, Listing 7.1).

I am using the adb shell to interface with the database from the command line and see that the database is being populated as I expect. Occasionally, I want to drop a table so that I can ensure it's being built properly, from scratch.

The problem is that SQLiteOpenHelper only checks to see if the database exists. Is there a typical solution to writing a helper to also see that the table(s) exists? Basically once I drop a table, the helper checks to see that the database exists and assumes all is well.

Also, the CREATE_DATABASE string used in the reference above only creates the one table. Should I consider using the DBAdapter for an adapter to ALL of my tables? That doesn't seem as clean to me.

Reference Material

© Stack Overflow or respective owner

Related posts about android

Related posts about sqlite