我有一个应用程序,用户可以上传一个图片作为他们的用户资料照片。在我的应用程序中,我允许用户使用原生裁剪器来裁剪图像。然而,当我尝试裁剪一张大图像时,我的Logcat会报以下错误:
!!! FAILED BINDER TRANSACTION !!!
Exception when starting activity com.example.somename/com.example.somename.Profile
android.os.TransactionTooLargeException
我使用以下代码启动裁剪器:
我使用以下代码启动裁剪器:
Intent cropIntent = new Intent("com.android.camera.action.CROP");
cropIntent.setDataAndType(imageFileUri , "image/*");
cropIntent.putExtra("crop", "true");
cropIntent.putExtra("aspectX", 1);
cropIntent.putExtra("aspectY", 1);
cropIntent.putExtra("outputX", 265);
cropIntent.putExtra("outputY", 265);
cropIntent.putExtra("scale", true);
cropIntent.putExtra("return-data", true);
startActivityForResult(cropIntent, PIC_CROP);
然后在我的onActivityResult方法中,以下代码获取裁剪后的图像:
Bundle extras = data.getExtras();
Bitmap selectedBitmap = extras.getParcelable("data");
imgDisplayPic.setImageBitmap(selectedBitmap);
我猜测问题出在裁剪器试图将一个大位图作为可包含的数据类型返回给我的活动。是否有任何解决办法?或者其他获取裁剪后图片的替代方案?
感谢您提前提供的任何帮助。