我处理图片的方法如下:
public static Bitmap getPicture(String fileName) {
Bitmap bm = null;
if (fileName != null) {
File file = new File(fileName);
if (file.exists()) {
try {
long size = file.length();
Log.i("picturePath",fileName);
if (size <= 3 * 102 * 1024) {
bm = BitmapFactory.decodeFile(fileName);
} else if (size <= 5 * 1024 * 1024) {
bm = BitmapFactory.decodeFile(fileName,
BitmapTool.getTempStorage((int) file.length()));
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
return bm;
}
public static BitmapFactory.Options getTempStorage(int size){
BitmapFactory.Options option = new BitmapFactory.Options();
option.inTempStorage = new byte[size];
return option;
}
图片大于1m后得到的bitmap就老是为null 请高手帮忙解决。