I am stuck with decoding a jpg file from Image URL location. I tried it with many different solution but unable to decode this.
Could you please give us a try on the following URL and let me know solution.
URL: 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;
}
}
Also this image successfully decoded by the iPhone Application. is there any limitation to decode image with Android ?
Thanks