我已经开始买了
DEBUG/skia(xxxx): --- decoder->decode returned false
关于我在 ImageViews 中使用的一些 Facebook 个人资料图片的问题。大多数都能完美运行,但偶尔我会发现一个永远无法运行。
出于向后兼容性的原因,我正在针对 Android 1.6 编译我的应用程序。
我做了一些挖掘,发现了许多关于这个问题的线索。我已经在使用这里讨论的 FlushedInputStream:http://code.google.com/p/android/issues/detail?id=6066
Bitmap b = BitmapFactory.decodeStream(new FlushedInputStream(is));
imageView.setImageBitmap(b);
这是一个给我带来麻烦的例子: http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs269.snc3/23132_639284607_390_q.jpg
有人可以查看图片并帮助我找出造成问题的原因吗?
最佳答案
这是一种对我有用的方法:
HttpGet httpRequest = new HttpGet(url);
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response = (HttpResponse) httpclient
.execute(httpRequest);
HttpEntity entity = response.getEntity();
BufferedHttpEntity bufferedHttpEntity = new BufferedHttpEntity(entity);
InputStream is = bufferedHttpEntity.getContent();
Drawable d = Drawable.createFromStream(is, "");
//or bitmap
//Bitmap b = BitmapFactory.decodeStream(is);
关于Android 解码器-> 解码返回 false 用于位图下载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4339082/