test image here: http://images.plurk.com/tn_4134189_bf54fe8e270ce41240d534b5133884ee.gif
I've tried several solutions found on the internet but there is no working solution.
I'm using the following snippet code:
Url imageUrl = new Url("http://images.plurk.com/tn_4134189_bf54fe8e270ce41240d534b5133884ee.gif");
Bitmap image = BitmapFactory.decodeStream(imageUrl.openStream());
Always getting this log:
DEBUG/skia(1441): --- decoder->decode returned false
Any help? Thanks.
EDIT:
Those images failed to be decoded are also can not be shown on a WebView
. But can see if open in a Browser.
For me the problem is with type of color of image: your image are in color=CYMK not in RGB
This should work:
myBitmap contains your image.
For memory reasons, you must be implements BitmapFactory options like this:
The main download bitmap function maybe like this:
And maybe you must be implements AsyncTask like this: http://android-developers.blogspot.com/2010/07/multithreading-for-performance.html
Maybe this is not your case but it could be if you are trying to decode images with CMYK colorspace, instead of RGB colorspace. CMYK images, like this one, are not supported by Android, and will not be displayed even in the Android web browser. Read more about this here:
Unable to load JPEG-image with BitmapFactory.decodeFile. Returns null
Try this:
I had the same problem, partially was fixed by this class:
}
And:
It helped in most cases, but this is not universal solution. For more refer to this bugreport.
Best luck!