简体   繁体   English

找不到处理 Intent 的活动:android.intent.action.EDIT

[英]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.

相关问题 找不到用于处理意图的活动{act = android.intent.action.View} - No activity found to handle intent { act=android.intent.action.View } 没有找到处理意图的活动{act=android,intent.action.VIEW} - No activity found to handle intent{act=android,intent.action.VIEW} 找不到可处理意图的活动,Android - no activity found to handle intent, android 找不到用于处理Intent {的活动“ act = android.intent.action.CALL dat =电话号码:1}? - No Activity found to handle Intent{ act=android.intent.action.CALL dat=Phone number:1 }? 找不到处理 Intent { act=android.intent.action.CALL dat=tel0710000001 } 的活动 - No Activity found to handle Intent { act=android.intent.action.CALL dat=tel0710000001 } 找不到活动来处理意图与操作和数据 - No Activity found to handle Intent with action and data android.content.ActivityNotFoundException:未找到任何处理Intent的活动{act = android.intent.action.GET_CONTENT - android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.GET_CONTENT android.content.ActivityNotFoundException:没有找到处理意图的活动{act=android.intent.action.VIEW dat=PendingIntent{} - android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=PendingIntent{ } 找不到可通过ACTION_VIEW Intent处理Intent的活动 - No Activity found to handle Intent With ACTION_VIEW Intent 未找到处理 Intent{typ=andrid.intent.action.PICK} 的活动 - No Activity found to handle Intent{typ=andrid.intent.action.PICK}
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM