Is it possible to add ZIP file to APK package as a raw resource and read it with ZipFile class? It looks like it’s trivial to open file from SD card, but not from APK.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I don’t believe so. As you alluded, it’s easy to use
ZipFilewith an actual file on the file system, but not so for a file embedded in your application.For accessing a zip file in your APK, you’d have to use something like
Resources.openRawResource(R.raw.zip_file)and then wrap the returnedInputStreamin aZipInputStreamand do it the usual Java way, rather than with the Android method.Alternatively, if you really find you need to use the
ZipFileclass, you could extract the zip file from the APK to the SD card or, more reliably, to your application’s local storage.