只是我需要下载图像,但问题是图像损坏了!!!我找到了很多下载图像的方法,但仍然出现了这个问题。
我试着这样做:
File path = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES);
File file2 = new File(path,"DemoPictureX.png");
InputStream is=(InputStream) new URL("http://androidsaveitem.appspot.com/downloadjpg").getContent();
OutputStream os = new FileOutputStream(file2);
byte[] data = new byte[is.available()];
is.read(data);
os.write(data);
is.close();
os.close();
我认为它只是从图像中读取了一些行!!!!