Circumventing /bin/data and appresources.zip on android

hi everybody,

i’m interested in avoiding the step of zipping up resources only to have the unzipped on the device – my project has 2GB of images/video and i believe this step is causing a painful startup time.

so far, i’ve avoided /bin/data by putting my resources.zip directly into /res/raw.

what i would like to do is avoid the copy + unzip altogether – is it possible to simply put all my files in their “final place” to begin with so as to avoid not only the zip step but also the copy?

that is, can i put my images/video somewhere else and then modify one of ofActivity.java/ofAndroid.java/ofUtils.cpp to correctly locate my image/video files?

thanks!

the problem with that is that android resources can usually only be accessed from the java side and have lots of restrictions in their names. classes like ofVideoPlayer, ofImage… won’t be able to access the files since at most you can get a java file handler. there’s a special ndk api where you can put some resources in assets and have direct access to them from c++ but all you can do is read their contents to memory through some special ndk calls so even with those ofVideoPlayer or ofImage won’t work.

1 Like

ah, bugger.

i saw that ndk call mentioned on stackoverflow, i assume this is the one you are talking about?

i must have read it too quickly because i didn’t realize it only gives file contents and not a file handle.

it sounds like there isn’t much i can do then besides maybe reducing the time spent unzipping resources.zip. however, i haven’t measured so i’m not sure if all the startup time is being spent during the resources.zip unzip step, the file copying step, or something else i don’t understand.

what exactly does the load percentage here represent, for example – is it just the unzip of resources?

anyways thank you arturo for the quick reply. i wonder what most people with big android of apps do to get around this… seems like a loading screen is the only answer.