开发者

SQLite database behaviour in android application development

Hi I am new to android app development and have 开发者_如何学JAVAno idea of SQLite database. Are The tables we create and the records we enter to the SQLite database tables happening run time. That means once create tables and insert data, do we have to do the same process again when exit and open the app again?(Only the database, tables and records remain until we open the particular app).

Thank you


Anything you do to the database is persistent. It will contain exactly the same data after your app shuts down and is later restarted.


The database and tables will remain after the app exits.

You can create a class that extends SQLiteOpenHelper to help.

Override the onCreate() and onUpgrade() methods there. onCreate() will get called only when your db doesn't exist yet. You can then execute sql to create the tables etc. onUpgrade will get called when you pass a new version number to the super() constructor.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜