[android-developers] Re: onCreate method of SQLiteOpenHelper also seems to execute "on opening" - ?bug

2008-09-17 Thread Mark Murphy
gymshoe wrote: > So does onCreate behave differently than I thought? If it behaves as you describe, it feels like a bug. > Is there a better way to do what I want? I don't know about "better", but in onCreate(), you could check to see if your tables exist (select count(*) from sqlite_master w

[android-developers] Re: onCreate method of SQLiteOpenHelper also seems to execute "on opening" - ?bug

2008-09-17 Thread gymshoe
Initially, after accessing the db, I did a count (via creating a cursor, doing a rawquery, and checking thte count) of the table and it contained records like it was supposed to. However, doing this seemed cumbersome compared to the more elegant solution of using the features of onCreate()... but

[android-developers] Re: onCreate method of SQLiteOpenHelper also seems to execute "on opening" - ?bug

2008-09-17 Thread gymshoe
I was able to obtain the expected function of the SQLiteOpenHelper method onCreate() with the code below, by including the database name in the SQLHelper constructor. Now onCreate() is only called for databases which are created, and not opened. public class SQLHelper extends SQLiteOpenHelper{