結局、最初に計画したことを実行するには、あまりにも多くのメモリが必要でした! 代わりに、一度に 1 つの ZipEntry を取得するだけになりましたが、必要な 1 つだけを毎回ループする必要はありません。
public Bitmap getBitmapFromZip(final String zipFilePath, final String imageFileInZip){
Bitmap result = null;
try {
ZipEntry ze = zipfile.getEntry(imageFileInZip);
InputStream in = zipfile.getInputStream(ze);
result = BitmapFactory.decodeStream(in);
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
すべての名前を取得するために、最初にすばやくループする必要がありました
public ArrayList<String> unzip() {
ArrayList<String> fnames = ArrayList<String>();
try {
FileInputStream fin = new FileInputStream(_zipFile);
ZipInputStream zin = new ZipInputStream(fin);
ZipEntry ze = null;
while ((ze = zin.getNextEntry()) != null) {
if(ze.isDirectory()) {
} else {
fnames.add(ze.getName()/*fname[fname.length - 1]*/);
zin.closeEntry();
}
}
zin.close();
} catch(Exception e) {
}
return fnames;
}