I'm using phonegap. I have created a plugin, but now I need to save the image on the sdcard given the image url. How can I save an image? I tried using FileOutputStream to save it, and it saves it on the sdcard but my application wasn't showing the image when linking it through html tag, so I did a pull request on the file, and open it on my computer and I think the image is corrupted or something because it doesn't open correctly. Amy I using the wrong stream? Which one should I use? thanks.
EDIT: I forgot to mention that at the top level its a zip file so before I save it I do something like
FileInputInputStream inputStream = null;
ZipInputStream zipInputStream = null;
inputStream = new FileInputStream(zipFilePath);
BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
zipInputStream = new ZipInputStream(bufferedInputStream);
ZipEntry entry = zipInputStream.getNextEntry();
while(entry != null){
String data = readFile(filePath); //uses zis.read(byteArra,offset,length) to read. Returns the result in a String
saveFile(newFilePath,data); //uses FileOutputStream to save via .write( byte[] ) method
}