WEB开发网
开发学院手机开发Android 开发 android 网络图片下载注意事项 阅读

android 网络图片下载注意事项

 2010-05-11 16:10:00 来源:WEB开发网   
核心提示:if (length != -1) {byte[] imgData = new byte[length];byte[] temp = new byte[512];int readLen = 0;int destPos = 0;while ((readLen = is.read(temp)) > 0) {Syste

if (length != -1) {

byte[] imgData = new byte[length];

byte[] temp = new byte[512];

int readLen = 0;

int destPos = 0;

while ((readLen = is.read(temp)) > 0) {

System.arraycopy(temp, 0, imgData, destPos, readLen);

destPos += readLen;

}

bitmap = BitmapFactory.decodeByteArray(imgData, 0,

imgData.length);

}

} catch (IOException e) {

bitmap = BitmapFactory.decodeResource(c.getResources(),

com.jixuzou.moko.R.drawable.defaultimg);

return bitmap;

}

return bitmap;

}

上一页  1 2 

Tags:android 网络 图片下载

编辑录入:coldstar [复制链接] [打 印]
赞助商链接