简体   繁体   English

未找到处理 Intent com.android.camera.action.CROP 的活动

[英]No activity found to handle Intent com.android.camera.action.CROP

I'm trying to do a picture from my application.我正在尝试从我的应用程序中制作图片。 I can launch the camera and do the picture, but when has finish to do the picture my app crash.我可以启动相机并拍照,但是当完成拍照时,我的应用程序崩溃了。 I can see in my screen that my gallery is stopped and this is the error in my log:我可以在屏幕上看到我的画廊已停止,这是我的日志中的错误:

I've tried to find something but haven't found anything.我试图找到一些东西,但没有找到任何东西。

FATAL EXCEPTION: main
                                                   android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.android.camera.action.CROP dat=file:///data/data/com.android.gallery3d/files/crop-temp (has extras) }
                                                       at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1628)
                                                       at android.app.Instrumentation.execStartActivity(Instrumentation.java:1423)
                                                       at android.app.Activity.startActivityForResult(Activity.java:3388)
                                                       at android.app.Activity.startActivityForResult(Activity.java:3349)
                                                       at com.android.camera.actor.PhotoActor.doAttach(PhotoActor.java:1125)
                                                       at com.android.camera.actor.PhotoActor.access$500(PhotoActor.java:62)
                                                       at com.android.camera.actor.PhotoActor$2.onClick(PhotoActor.java:210)
                                                       at android.view.View.performClick(View.java:4209)
                                                       at android.view.View$PerformClick.run(View.java:17431)
                                                       at android.os.Handler.handleCallback(Handler.java:725)
                                                       at android.os.Handler.dispatchMessage(Handler.java:92)
                                                       at android.os.Looper.loop(Looper.java:153)
                                                       at android.app.ActivityThread.main(ActivityThread.java:5297)
                                                       at java.lang.reflect.Method.invokeNative(Native Method)
                                                       at java.lang.reflect.Method.invoke(Method.java:511)
                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
                                                       at dalvik.system.NativeStart.main(Native Method)

This is my code:这是我的代码:

@Override
    public void onButton1Click(int ref) {
        try {
            currentRef = ref;
            Intent mIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

            Uri fileUri = FileProvider.getUriForFile(getActivity(), BuildConfig.APPLICATION_ID + ".provider", createImageFile());
            mIntent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file name
            mIntent.putExtra("crop", "true");
            startActivityForResult(mIntent, REQUEST_TAKE_PHOTO);
        }catch (IOException ex) {
            ex.printStackTrace();
        }
    }


private File createImageFile() throws IOException {
        // Create an image file name
        String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
        String imageFileName = "JPEG_" + timeStamp + "_";
        File storageDir = new File(Environment.getExternalStoragePublicDirectory(
                Environment.DIRECTORY_DCIM), "Camera");
        File image = File.createTempFile(
                imageFileName,  /* prefix */
                ".jpg",         /* suffix */
                storageDir      /* directory */
        );

        // Save a file: path for use with ACTION_VIEW intents
        mCurrentPhotoPath = "file:" + image.getAbsolutePath();
        return image;
    }

No, Android Does Not Have a Crop Intent不,Android还不意图作物

Many developers are calling startActivity() on an Intent with an action of com.android.camera.action.CROP .许多开发人员正在使用com.android.camera.action.CROP操作在 Intent 上调用startActivity() They are doing this to crop an image.他们这样做是为了裁剪图像。

This is a really bad idea.这真是一个糟糕的主意。

Source here - CommonsBlog 来源在这里 - CommonsBlog

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找不到活动来处理Intent act = com.android.camera.action.CROP - No Activity found to handle Intent act=com.android.camera.action.CROP com.android.camera.action.CROP活动未更新其图像 - com.android.camera.action.CROP activity not updating its image com.android.camera.action.CROP卡住 - com.android.camera.action.CROP stucks com.android.camera.action.CROP替代? - com.android.camera.action.CROP alternative? 使用“com.android.camera.action.CROP”意图裁剪图像,在某些设备上返回小尺寸位图 - Using “com.android.camera.action.CROP” Intent to crop images, returns small size bitmaps on some devices 新的Intent(“ com.android.camera.action.CROP”),我想更改颜色背景,按钮等 - new Intent(“com.android.camera.action.CROP”), I would like change color background, button and other 如何使用com.android.camera.action.CROP裁剪位图 - how to crop bitmap using com.android.camera.action.CROP com.android.camera.action.CROP在Motorola Defy上设置壁纸 - com.android.camera.action.CROP sets wallpaper on Motorola Defy com.android.camera.action.CROP在Objective-C吗? - com.android.camera.action.CROP in objective-c? 使用com.android.camera.action.CROP的Android圆形裁剪图像在HTC设备中返回黑色图像 - Android circular crop image using com.android.camera.action.CROP returning black image in HTC devices
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM