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)