[英]No Activity found to handle Intent : android.intent.action.EDIT
I want to open crop intent after picking image or capturing through camera.我想在选择图像或通过相机捕获后打开裁剪意图。
Gallery:
画廊:
Intent cropIntent = new Intent("android.intent.action.EDIT");
cropIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
cropIntent.setDataAndType(file, "image/*");
cropIntent.putExtra("crop", "true");
cropIntent.putExtra("aspectX", 1);
cropIntent.putExtra("aspectY", 1);
cropIntent.putExtra("outputX", 256);
cropIntent.putExtra("outputY", 256);
cropIntent.putExtra("return-data", true);
startActivityForResult(cropIntent, CROP_PIC);
Camera:
相机:
Intent cropIntent = new Intent("android.intent.action.EDIT");
cropIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
File file = new File(filePath);
Log.i("checker", "does " + file.getAbsolutePath() + " exist ?" + file.exists());
Uri uri = Uri.fromFile(file);
cropIntent.setDataAndType(uri, "image/*");
cropIntent.putExtra("crop", "true");
cropIntent.putExtra("aspectX", 1);
cropIntent.putExtra("aspectY", 1);
cropIntent.putExtra("outputX", 256);
cropIntent.putExtra("outputY", 256);
cropIntent.putExtra("return-data", true);
startActivityForResult(cropIntent, CROP_PIC);
It works on most of devices, but on Galaxy Tab A (Android 11.0)
while opening edit intent it gives exception:它适用于大多数设备,但在
Galaxy Tab A (Android 11.0)
上打开编辑意图时出现异常:
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.EDIT dat=content://media/external/images/media/356 typ=image/* flg=0x1 (has extras) }
I am using This edit intent though crop intent would suffice,because on Galaxy Tab A when recieving image through gallery, the image is rotated 90 degree counter clockwise dont know why.我正在使用此编辑意图,但裁剪意图就足够了,因为在 Galaxy Tab A 上通过画廊接收图像时,图像逆时针旋转 90 度,不知道为什么。 so using edit intent and its not working either.
所以使用编辑意图并且它也不起作用。
You can use the Image cropper library please review it and use it.您可以使用图像裁剪器库,请查看并使用它。
https://github.com/ArthurHub/Android-Image-Cropper https://github.com/ArthurHub/Android-Image-Cropper
https://github.com/Yalantis/uCrop https://github.com/Yalantis/uCrop
I hope it's helpful to you!!希望对你有帮助!!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.