我正在尝试缩放用相机拍摄的照片,但我不确定在哪里或如何做到这一点。现在代码正在访问相机,拍照并在列表视图中显示它,我也想获取图片路径,但我也不确定如何执行此操作。任何帮助将不胜感激。
/**
* This function is called when the add player picture button is clicked.
* It accesses the devices gallery and the user can choose a picture
* from the gallery.
* Or if the user chooses to take a picture with the camera, it handles that
*/
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case TAKE_PICTURE:
if (resultCode == Activity.RESULT_OK) {
Uri selectedImage = imageUri;
getContentResolver().notifyChange(selectedImage, null);
ContentResolver cr = getContentResolver();
this.picPath = selectedImage.getPath();
Bitmap bitmap;
try {
bitmap = android.provider.MediaStore.Images.Media
.getBitmap(cr, selectedImage);
imageView = (ImageView) findViewById(R.id.imagePlayer);
imageView.setImageBitmap(bitmap);
Toast.makeText(this, selectedImage.toString(),
Toast.LENGTH_LONG).show();
} catch (Exception e) {
Toast.makeText(this, "Failed to load", Toast.LENGTH_SHORT)
.show();
Log.e("Camera", e.toString());
}
}
谢谢