0

Is there a simple and elegant way to create a database from a script in Android ? I want to create my database on the first run from a script (maybe I'll have to parse the file), is that a non-android method cause I can't find a lot on this subject ?

My script only creates tables (there are no INSERT statements).

Thank's

3
  • Why do you want to do that? Android has all sorts of functions built in to help create a database. Commented May 26, 2012 at 13:16
  • @Fr4nz, it may be best if you explain why you wish to accomplish this. (i.e will every person have a different verion of the database? or the database will change without releasing a new build?) Otherwise, you will get responses very similar to the one above. Ultimately, there are a ton of ways to get what you want accomplished, but without more direction we will have very little ability to help you. Perhaps detailing the user experience may help? Commented May 26, 2012 at 15:43
  • Indeed, I need my database to store content for the offline mode of my app (when there is no connexion). It's the same database for every users, the tables are updated when the user uses the app with an active Internet connexion. How would you create such a database ? It contains 10 tables. Commented May 27, 2012 at 16:39

1 Answer 1

2

You can try shipping the entire db in your app.

Your own sqlite db

You can also bundle a .sql file in your assets and then execute those scripts. Android APIs

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.