我的代码如下

is = new FileInputStream(new File(baseMagazinePath + this.bookId + "/" + fileList[currentImgNo] + ".png"));
iv.setImageDrawable(Drawable.createFromStream(is, "myStream"));

有时候出现内存溢出

改为
is = new FileInputStream(new File(baseMagazinePath + this.bookId + "/" + fileList[currentImgNo] + ".png"));
BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inSampleSize = 4;
Bitmap bitmap = BitmapFactory.decodeStream(is, null, opts);
iv.setImageBitmap(bitmap);

就好了。

更多相关文章

  1. android代码实现免提功能
  2. CentOS 下载 Android 源代码。
  3. Android代码总结,Sdcard和图片相关
  4. android 下载不了源代码?
  5. android 2.2 完全 退出 ---程序代码
  6. Android 功能代码总结

随机推荐

  1. Android(安卓)Wi-Fi 设置带宽代码流程
  2. RelativeLayout
  3. Android(安卓)studio 遇到Android(安卓)S
  4. inputtype
  5. Android(安卓)单选按钮Radio的使用
  6. Android中Dialog对话框
  7. scrollView嵌套recyclerView 显示不全
  8. Android总结篇系列:Android(安卓)权限
  9. Android(安卓)WebView
  10. EditText设置键盘操作