解决方案 »
- addContentView和setContentView的区别
- 如何下载Index.html
- listview问题
- 如何按自己编写的格式去发送邮件
- webview执行本地网页的js脚本报错
- [求助]怎样在一个SQL数据库里创建多个表
- 怎么能替换RadioButton的选中图片 在线等
- (高手进)一般公司项目都三个listview,配置三个Adapter.现在我想封装BaseAdapter,让三个listview,配置一个Adapter.
- Android代码大家都用什么管理?
- andriod 运行纯c程序出错[1]stopped (singal) 和 andriod [1] Segmentation fault错误
- android wifi定位设置
- surfaceView中的线程问题
nReadLen = dis.read(buffer, nIdx, nTotalLen - nIdx); 检查一下是否是下标有问题。 public static byte[] readInputStream(InputStream ins) {
if (ins == null) {
return null;
}
BufferedInputStream bis = new BufferedInputStream(ins);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
byte[] buffer = new byte[128];
int n = -1;
while ((n = bis.read(buffer)) != -1) {
bos.write(buffer, 0, n);
}
} catch (IOException e) {
e.printStackTrace();
return null;
} finally {
if (bis != null) {
try {
bis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return bos.toByteArray();
}
读完了所有的数据流以后 再进行byte数组操作。
建议把网络操作放到线程里面。