In my android App I download some photographs from the internet.How can I verify that an image from the web is correctly downloaded? I've thought of checking the file's size I've just written on sd is greater that zero, but I don't know if this is sufficient. this is my code
String filename =title.replace(" ","")+j+".nomedia";
File destination = new File(MyApplication.getPhotoStorage() ,filename);
URL url = new URL (url_image);
InputStream is = url.openStream();
OutputStream os = new FileOutputStream(destination);
byte[] b = new byte[2048];
int length;
while ((length = is.read(b)) != -1) {
os.write(b, 0, length);
}
is.close();
os.close();
localPhotosUrl.add(destination.getAbsolutePath());