我的代码如下
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);
就好了。