1

We have a zip folder that contains sounds and pictures in our app.

When someone download the app, we want it to be installed on the tablet so the app can take the ressources it needs in the unzipped folder.

How can we do to put the zip on the tablet and unzip it ONLY on the installation?

We tried to look that thread : How to unzip files programmatically in Android? but couldn't find a way to make it work for our case. Any help is appreciated

Community
  • 1
  • 1
JohnnyBgud
  • 107
  • 4
  • 2
    Why not just place those files (_sounds and picture_) in the `assets` folder instead? To extract the zip file, you would have to include / package the zip file in the `assets` folder anyway. I don't see a reason for the extra step. – Siddharth Lele Jan 06 '16 at 08:15
  • You can embed zip file in assets folder when export apk then in the first time app run then you can extract it to other path (sdcard) to use. – GiapLee Jan 06 '16 at 08:18
  • we would like an external folder so the user can add ressources whenever he wants in it, but we've never done such a thing so we're kinda lost, that's why we thought the best way was to install a folder on the tablet. But we found no way to do that and there is not much help about how to do this on the Internet – JohnnyBgud Jan 06 '16 at 08:19
  • @JohnnyBgud: Still, you could simply _bundle_ the audio and image files in the `assets` folder and use [this solution for example](http://stackoverflow.com/q/4447477/450534), to transfer the files to a location on the sdcard. That way, your use case will be served. And it would be a much simpler method as compared to unzipping. – Siddharth Lele Jan 06 '16 at 08:21
  • Okay so the easy way to do this is : put zip file in assets, unzip this on the desired path (using the same method as the linked thread) on the first time app runs and that's it? – JohnnyBgud Jan 06 '16 at 08:22
  • @Iceman Thanks it looks like the easiest solution indeed, I'm sorry if I duplicate a question but I really had no idea on how to do so..; thanks for the advices – JohnnyBgud Jan 06 '16 at 08:23
  • You are welcome @JohnnyBgud. I am glad I could point you to a solution ;-) – Siddharth Lele Jan 06 '16 at 08:25
  • Just one last thingy, can the assets contain a folder? Our data is stocked this way : mainfolder -> multiple small folders -> one sound one image ineach folder. Can we just move the main folder or not? this is why we wanted to zip it at first (I don't know if i'm able to ask it here in the comments i'm quite new here as an asker) – JohnnyBgud Jan 06 '16 at 08:28
  • Oh absolutely. I have often had 1 _root_ folder in the assets folder with 2 - 3 sub folders in the _root_ folder. And they work just fine. Just pay attention to the paths when coding and you'll be good to go. – Siddharth Lele Jan 06 '16 at 08:35

0 Answers0