您的位置:首页 > 其它

开发中所遇到的一些问题与解决方法(2)

2015-04-02 16:07 555 查看
2.开发中,new GZIPInputStream(urlConnection.getInputStream())

这行代码抛了IOException.在网上看到的一个解决方法(http://stackoverflow.com/questions/5131016/gzipinputstream-fails-with-ioexception-in-android-2-3-but-works-fine-in-all-pre):

InputStream in = url.openStream();

GZIPInputStream zin;

try {2.3以后

zin = (GZIPInputStream)in;

} catch (Exception e) {//2.3以前

zin = new GZIPInputStream(in);

}

解释是: It looks like Gingerbread (2.3) changed the way GZipped streams are handled. Looking at the "magic block" characters indicates that openStream() automatically detects GZipped data and runs it through the correct stream decoder. Of course, if you attempt
to run another GZIP decoder on the same stream, that will fail with an IOException.

1.SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length

在edittext上输入几个字母,将光标移到前面,再将光标移到后面,就报了这个错误。后来在stactoverflow上找到了解决方法。将edittext的inputType属性值修改为 android:inputType="textNoSuggestions",就解决了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: