我被困在从图像URL位置解码一个jpg文件。我尝试了许多不同的解决方案,但无法解码。
你能不能试一下下面的网址,让我知道解决方案。
网址:http://halosys.co.in/FTP-LOCATION/ftp-user15/testing2.jpg
InputStream in = new java.net.URL(imageURL).openStream();
Bitmap bImage = BitmapFactory.decodeStream(new FlushedInputStream(in));
imageView.setImageBitmap(bImage);
static class FlushedInputStream extends FilterInputStream {
public FlushedInputStream(InputStream inputStream) {
super(inputStream);
}
@Override
public long skip(long n) throws IOException {
long totalBytesSkipped = 0L;
while (totalBytesSkipped < n) {
long bytesSkipped = in.skip(n - totalBytesSkipped);
if (bytesSkipped == 0L) {
int b = read();
if (b < 0) {
break; // we reached EOF
} else {
bytesSkipped = 1; // we read one byte
}
}
totalBytesSkipped += bytesSkipped;
}
return totalBytesSkipped;
}
}此外,iPhone应用程序还成功解码了此图像。Android对图片的解码有限制吗?
谢谢
发布于 2013-07-22 20:17:19
有图像的问题,该图像是skia图形启用,所以你面临这个问题。
https://stackoverflow.com/questions/17761438
复制相似问题