I'm kinda new to android and java programming, can someone tell me how to save the files, I have the following codes:
InputStream is = new FileInputStream( location + "/zipSample.zip");
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(is));
try {
ZipEntry ze;
while ((ze = zis.getNextEntry()) != null) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int count;
while ((count = zis.read(buffer)) != -1) {
baos.write(buffer, 0, count);
}
String filename = ze.getName();
byte[] bytes = baos.toByteArray();
// Do something with 'filename' and 'bytes' ...
// How do I save to sdcard?
}
} finally {
zis.close();
}
Thanks a lot for any help.
Good answer already posted it looks like, if you need more help just ask: Writing a file to sdcard
FileDemo2.java:
main.xml: