I'm writing my first serious Android App, which basically is interface to three DB tables. Data in those tables are predefined by me, so, user should install those app with those data. What 开发者_JS百科is the best way to include those data in application package? Maybe there is a way to embed SQLite into my application distribution? Or is the only way is to define array of "insert into" strings somewhere in class and execute them to fill internal SQLite storage? Would appreciate any recommendations.
I am currently doing the same thing in my app. Having a sqlite database file in my assets folder and copying it into the SD card at startup if it's not in there. There's a nice tutorial there and I use part of its code.
Put the database file in your assets and then copy it over to your application's data directory.
Your can check out this tutorial
精彩评论