insert initial data to sql lite android

前端 未结 4 1424
生来不讨喜
生来不讨喜 2021-01-26 00:34

I\'m developing an expense tracker where I want to populate the DB with a few records when the application first start. I tried to call the method in my splash activity and add

4条回答
  •  鱼传尺愫
    2021-01-26 01:13

    try to add a flag in your user preferences/shared preferences to check the apps first run and then upon return you can decide if you want to create your db or read it !
    have a look here http://www.vogella.com/articles/AndroidSQLite/article.html
    EDIT
    or just check if dbexists instead of user pref flag

提交回复
热议问题