使用内置Gallery应用程序选择图像(4)

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());

          } 

     } 

   } 

}

需要在项目的layout/main.xml文件中包含如下内容:

读书导航