0

私のアプリケーション要件では、ギャラリーから画像を選択し、選択した画像をトリミングしてイメージビューに設定します。以下は、画像をトリミングするためのサンプル コードです。

//call the standard crop action intent (the user device may not support it)
    Intent cropIntent = new Intent("com.android.camera.action.CROP");
    cropIntent.setClassName("com.android.camera", "com.android.camera.CropImage");
    //indicate image type and Uri
    cropIntent.setDataAndType(mImageCaptureUri, "image/*");
    //set crop properties
    cropIntent.putExtra("crop", "true");
    //indicate aspect of desired crop
    cropIntent.putExtra("aspectX", 1);
    cropIntent.putExtra("aspectY", 1);
    //indicate output X and Y
    cropIntent.putExtra("outputX", 256);
    cropIntent.putExtra("outputY", 256);
    //retrieve data on return
    cropIntent.putExtra("return-data", true);
    cropIntent.putExtra(MediaStore.EXTRA_OUTPUT, mImageCaptureUri);
    cropIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
    //start the activity - we handle returning in onActivityResult
   startActivityForResult(cropIntent, PIC_CROP);

上記のコードは、以下の Android マシュマロ デバイスでは正常に動作しますが、Android マシュマロはクラッシュしています。問題を解決するにはどうすればよいですか?

4

1 に答える 1