相机裁剪代码在Android 7.0上不起作用

相机裁剪代码在Android 7.0上不起作用,android,camera,crop,android-7.0-nougat,Android,Camera,Crop,Android 7.0 Nougat,我的代码适用于Android 4到Android 6.x的所有设备 但当我在安卓7.0上更新了我的设备后,相机代码就不再有效了。我有黑屏 我可以从相机上拍摄,但之后如果我想裁剪图像,我会回到屏幕上 可能是裁剪函数没有获得位图的正确路径 有什么想法吗?代码如下: img = (ImageView) findViewById(R.id.imageView); img_original = (ImageView) findViewById(R.id.imageView_or

我的代码适用于Android 4到Android 6.x的所有设备 但当我在安卓7.0上更新了我的设备后,相机代码就不再有效了。我有黑屏

我可以从相机上拍摄,但之后如果我想裁剪图像,我会回到屏幕上

可能是裁剪函数没有获得位图的正确路径

有什么想法吗?代码如下:

     img = (ImageView) findViewById(R.id.imageView);
        img_original = (ImageView) findViewById(R.id.imageView_original);
    }

    public void Capture(View view) {
        Capture_Cam();
    }

    private void Capture_Cam() {
        Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
        startActivityForResult(cameraIntent, 1);

    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {  


        if (requestCode == 1 && resultCode == RESULT_OK && data != null) {

                picUri = data.getData();
                try {
                    // bitmap2 = MediaStore.Images.Media.getBitmap(this.getContentResolver(), picUri); // bitmap2 = original before cur
                    bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), Uri.parse("file://"+picUri));
                    img_original.setImageBitmap(bitmap);

                } catch (IOException e) {
                    e.printStackTrace();
                }
                performCrop();

        } else if (requestCode == 2) {

            bitmap2=(Bitmap) data.getExtras().get("data");
            img.setImageBitmap(bitmap2);

         }else{
            super.onActivityResult(requestCode, resultCode, data);
        }

    }

       private void performCrop(){
        try {

            Intent cropIntent = new Intent("com.android.camera.action.CROP");
            //indicate image type and Uri
            cropIntent.setDataAndType(picUri, "image/*");
            cropIntent.putExtra("crop", "true");
            cropIntent.putExtra("aspectX", 1);
            cropIntent.putExtra("aspectY", 1);
            cropIntent.putExtra("outputX", 100);
            cropIntent.putExtra("outputY", 100);
            cropIntent.putExtra("scale", true);
            cropIntent.putExtra("return-data", true);
            startActivityForResult(cropIntent, 2);
            Toast toast = Toast.makeText(this, "Done", Toast.LENGTH_SHORT);
        }
        catch(ActivityNotFoundException anfe){
            //display an error message
            String errorMessage = "Whoops - your device doesn't support the crop action!";
            Toast toast = Toast.makeText(this, errorMessage, Toast.LENGTH_SHORT);
            toast.show();
        }

    }

}

你有什么解决办法吗?