Android sql creating database once

Posted by semajhan on Stack Overflow See other posts from Stack Overflow or by semajhan
Published on 2011-01-07T23:55:51Z Indexed on 2011/01/08 0:54 UTC
Read the original article Hit count: 141

Filed under:
|
|
|
|

One thing i'm not understanding is how to create the database and data just once in an android application. I extend SQLiteOpenHelper and use a DataHelper class that to manipulate data. Now, I have addEvent() and updateEvent() within the DataHelper class. I create an instance of DataHelper in my Activity and addEvent() a couple of times to insert data. Well, now I don't know how to just do that once. If I restart the app, its just going to "addEvent()" again and so the data is being reset every time. Sorry for the probably really REALLY noob question.

The only solution I found was not using the DataHelper class and just adding data "manually" within the onCreate() method in SQLiteOpenHelper.

© Stack Overflow or respective owner

Related posts about java

Related posts about sql