开发者

Android: is it possible to add ZIP file as a raw resource and read it with ZipFile?

Is it possi开发者_如何学Cble 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.


I don't believe so. As you alluded, it's easy to use ZipFile with 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 returned InputStream in a ZipInputStream and do it the usual Java way, rather than with the Android method.

Alternatively, if you really find you need to use the ZipFile class, you could extract the zip file from the APK to the SD card or, more reliably, to your application's local storage.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜