4

My application uses a database which it gets as a .sqlite file from a webserver at runtime. This database can change, hence the need to get it at runtime. I have seen this link -http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/ but it assumes that we are preloading the application with the database. How do I download this file and use it in Android at runtime?

jAcky
  • 73
  • 5
  • 1
    You can download the file and import it into the database: http://stackoverflow.com/questions/6540906/android-simple-export-import-of-sqlite-database – Peter Knego Oct 03 '11 at 19:08
  • Is this .sqlite file a script to populate a db, or the actual db? – Jack Oct 03 '11 at 19:09
  • 1
    @Jack - This is the actual DB itself. The thing is, this file is not an Android DB with the android-metadata table or the primary key name set to _id. Would it still work if I imported it? – jAcky Oct 03 '11 at 19:31

1 Answers1

1

Please see this link for an explanation on how to download a file from the internet. It uses an image, but its the same process for any file.

After that you can follow this question which shows how to import the file (linked by Peter Knego).

Community
  • 1
  • 1
Jack
  • 9,156
  • 4
  • 50
  • 75