if (heightRatio > 1 && widthRatio > 1)
{
if (heightRatio > widthRatio) {
bmpFactoryOptions.inSampleSize = heightRatio;
}
else {
bmpFactoryOptions.inSampleSize = widthRatio;
}
}
bmpFactoryOptions.inJustDecodeBounds = false;
bmp = BitmapFactory.decodeStream(getContentResolver().
openInputStream(imageFileUri), null, bmpFactoryOptions);
choosenImageView.setImageBitmap(bmp);
} catch (FileNotFoundException e) {
Log.v("ERROR",e.toString());
}
}
}
}
需要在項(xiàng)目的layout/main.xml文件中包含如下內(nèi)容: