if (resultCode == RESULT_OK)
{
// 获取ImageView的引用
imv = (ImageView) findViewById(R.id.ReturnedImageView);
Display currentDisplay = getWindowManager().getDefaultDisplay();
int dw = currentDisplay.getWidth();
int dh = currentDisplay.getHeight();
// 加载图像的尺寸而不是图像本身
BitmapFactory.Options bmpFactoryOptions = new BitmapFactory
.Options();
bmpFactoryOptions.inJustDecodeBounds = true;
Bitmap bmp = BitmapFactory.decodeFile(imageFilePath,
bmpFactoryOptions);
int heightRatio = (int)Math.ceil(bmpFactoryOptions.
outHeight/(float)dh);
int widthRatio = (int)Math.ceil(bmpFactoryOptions.
outWidth/(float)dw);
Log.v("HEIGHTRATIO",""+heightRatio);
Log.v("WIDTHRATIO",""+widthRatio);
// 如果两个比率都大于1,
// 那么图像的一条边将大于屏幕
if (heightRatio > 1 && widthRatio > 1)