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
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
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{
3 matches
Mail list logo