If I use your code quality of image corrupted .
private Bitmap decodeFile(File f) {
final int MAX_SIZE = 400;
try {
BitmapFactory.Options o = new BitmapFactory.Options();
o.inJustDecodeBounds = true;
FileInputStream fis = new FileInputStream(f);
BitmapFactory.decodeStream(fis, null, o);
fis.close();
int scale = 1;
if (o.outHeight > MAX_SIZE || o.outWidth > MAX_SIZE) {
scale = (int) Math.pow(
2,
(int) Math.round(Math.log(MAX_SIZE / (double) Math.max(
o.outHeight, o.outWidth)) / Math.log(0.5)));
}
// Decode with inSampleSize
BitmapFactory.Options o2 = new BitmapFactory.Options();
o2.inSampleSize = scale;
fis = new FileInputStream(f);
Bitmap b = BitmapFactory.decodeStream(fis, null, o2);
fis.close();
return b;
} catch (IOException e) {
} catch (OutOfMemoryError e) {
this.clearCache();
}
return null;
}
If I use your code quality of image corrupted .
private Bitmap decodeFile(File f) {
final int MAX_SIZE = 400;
try {