0

First of all let me tell you why i ask this question (perhaps i'm in the wrong way):

My program will use SQLite. Every tuto/docs i found regarding SQLite talk about DatabaseHelper. This means that database is created and filled from code.

I have a lot of data to place in my database during apk installation, and i don't want to keep useless data that serves only installation.

So my idea :

-write a file (e.g : .xml) with my my database tables contents (like 10000 lines for a couple of tables).

-At first launch (or during installation) init my database with that data file

-then delete that data file that is not needed anymore to free some "disk" space.

Is it a good idea?

Can we do it?

Or with other words, how to init a "big" database without using useless disk/memory space?

PS : i don't have any server to host a file ;)

EDIT : i'm not sure we can talk of duplicate as i'm looking for deleting temporary file just used during installation. if my database cost 10MB, why using: 10MB of bdd + 10MB of data file that served only once during installation? Duplicate question just talk about bdd init, not temporary init file.

Giova
  • 846
  • 1
  • 10
  • 13
  • i'm not sure we can talk of duplicate as i'm looking for deleting temporary file just used during installation. if my database cost 10MB, why using: 10MB of bdd + 10MB of data file that served only once during installation? – Giova Aug 12 '14 at 21:53

1 Answers1

1

Can we do it?

No. Anything that you ship that is packaged with your app (e.g., assets, raw resources) cannot be deleted.

You are welcome to download a database, or data to put into a database, from the Internet on first run of your app, if you wish.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Thanks for your answer. Well my apk will keep my bdd content then. I've also found a [good article here](http://www.limbaniandroid.com/2013/02/useing-your-sqlite-database-in-android.html) on how to deploy a db. – Giova Aug 12 '14 at 22:27