android bitmap溢出问题完美解决方案
16lz
2021-01-23
public static Bitmap getLoacalBitmap(String url) {
try {
BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inPreferredConfig = Bitmap.Config.RGB_565;
opt.inPurgeable = true;
opt.inInputShareable = true;
FileInputStream fis = new FileInputStream(url);
return BitmapFactory.decodeStream(fis, null, opt); // /把流转化为Bitmap图片
} catch (FileNotFoundException e) {
e.printStackTrace();
return null;
}
}
try {
BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inPreferredConfig = Bitmap.Config.RGB_565;
opt.inPurgeable = true;
opt.inInputShareable = true;
FileInputStream fis = new FileInputStream(url);
return BitmapFactory.decodeStream(fis, null, opt); // /把流转化为Bitmap图片
} catch (FileNotFoundException e) {
e.printStackTrace();
return null;
}
}
更多相关文章
- android加载大图片
- Android之Glide(非常好用的图片加载框架)
- Android加载Gif图片的一般方法:Movie实现
- Android九宫格图片(9.png)的讲解与制作
- android 图片处理 resize 探秘(图片缩放、压缩问题)
- Android视频图片缩略图的获取
- [Android] Json格式解析和文字图片传输
- Android 图片的浏览、缩放、拖动和自动居中
- android 从matrix获取处理过的图片的实际宽度