Skip to content Skip to sidebar Skip to footer

Saving An Image In Android

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,

Solution 1:

The problem wasn't the stream I was using but converting the byte[] to String. Something went wrong in the conversion and so when I went to save the whole string into the file something probably got corrupted. So Instead of reading the whole file into a byte array and then converting to a string for every file type, I just do that for the text files, and for image files I just read and save through the byte array


Post a Comment for "Saving An Image In Android"