1

I'm new to programming so be gentle...

My Android app will have many pictures since it's a reference app with many diagrams to view. Because of this it will likely be >50mb if I package all of the images in the apk. How can I make the file download a folder full of the images when the app is first opened if they are not already downloaded?

For example, the android app Jefit has the option of downloading the gif animation files of all the exercises. How can I make my app download its image resources upon its first run if they aren't already present on the sd-card.

Any help would be greatly appreciated! Thanks.

1 Answers1

1

You'd use the shared preferences (http://developer.android.com/guide/topics/data/data-storage.html#pref) to set a flag that indicates to your application (let's say in your launch activity's onCreate() method) if your resources have already been downloaded or not, with 3 integer states : "not downloaded yet", "downloading", and "downloaded".

Then the download manager (http://developer.android.com/reference/android/app/DownloadManager.html) should help for the download and set your flag to "downloaded" on completion.

Finally, here is an example of unzipping a folder to SD card : Android - Unzip a folder?

Community
  • 1
  • 1
darma
  • 4,687
  • 1
  • 24
  • 25