There is a bug in FlushedInputStream(is). it fails on slow connections but you can try my magical code to fix it. create a static class outside your method and here you go.. now you will not have any problem.Bitmap b = BitmapFactory.decodeStream(new FlushedInputStream(is));imageView.setImageBitmap(b);
?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;? ? ? ? }? ? }
详细解决方案
Android decoder->decode returned false for Bit地图 download
热度:261 发布时间:2016-05-01 17:21:26.0
相关解决方案
- 怎么取<s:property value="news.CONTENT" escape="false"/>内容前几位
- 为什么Ext.getCmp("panelID").collapsed = false;无效呢
- struts2-json中诠注@JSON(deserialize=false)是什么用?不是阻止JSON反序列化成JAVA对象吗?求解
- JSP文件开头声明了是一个上载文件(contentType="application/x-download"),是不是就不能在上面执行javascript和html了
- 个别字符乱码有关问题。js encodeURI(str)转码 后台java.net.URLDecoder.decode(str, "UTF-8")转码
- 为什么ibatis 里面用case decode 都无法解析解决方法
- android 读取byte[]中的元素解决方案
- android 标题栏兑现方式
- android 中Activity向BroadcastReceiver发送数据,该怎么解决
- Android 4.0 为什么模拟器老是提示小弟我谷歌拼音输入法已停止
- android:getSharedPreferences() 这是哪个类的方法解决思路
- android 怎么判断一个程序是否联网
- android RadioButton如何设置默认选中
- android 怎么重新设置锚点
- android 图片对象获取的有关问题
- android 关于服务连接的疑义
- android 怎么实现对view的放大和缩小
- android ID,该如何处理
- 准备复习2-3个月,看java+android,请问有经验者,怎么看效果最好》
- android UI线程与AsyncTask的有关问题
- MyEclipse错误:Java was started but returned exit code = 1
- Java 中 .setVisible(false);以后是否还在运行
- android(java) 中文乱码的有关问题
- btn.Enable=false||a>5&&a<100 是如何运算的
- 表单交付给自己,IsPostBack==false
- 后台的textbox控件设置enable=false,怎么使用js设置为true呢
- 怎么修改控件Enabled="false"后的样式
- AutoEventWireup=“false”Page_Load如何执行?
- 为什么小弟我把EnableViewState="false"还是出现了<input type="hidden" name="EVENTTARGET" id="EVENTTARGET" value="" />
- FileUpload.HasFile属性永远为"false"该怎么处理