android bitmap溢出问题完美解决方案

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;
}


}

你可能感兴趣的:(android)