裁剪圖片中遇到問題,怎麼解決?

問題代碼:android

Intent cropIntent = new Intent("com.android.camera.action.CROP");
                        cropIntent.setType("image/*");
                        cropIntent.putExtra("crop", "true");
                        cropIntent.putExtra("aspectX", 1);
                        cropIntent.putExtra("aspectY", 1);
                        cropIntent.putExtra("outputX", Conf.getInt("IMAGE_WIDTH"));
                        cropIntent.putExtra("outputY", Conf.getInt("IMAGE_HEIGHT"));
                        cropIntent.putExtras(extras);
                        startActivityForResult(cropIntent, CROP_REQUEST_CODE);

這是4.3之前用的方法,那自從升級到4.4之後,該如何使用呢?
this

try {
    int aspectX = 750;
    int aspectY = 1011;

    Intent intent = new Intent(this, CropImage.class);
    intent.putExtra(CropImage.IMAGE_PATH, path);

    intent.putExtra(CropImage.SCALE, true);

    intent.putExtra("aspectX", aspectX);
    intent.putExtra("aspectY", aspectY);

    intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(mCurrentPhotoPath)));

    startActivityForResult(intent, CROP);
    
    }catch (ActivityNotFoundException anfe) {
    
    String errorMessage = "Your device doesn't support the crop action!";
    Toast toast = Toast.makeText(this, errorMessage, Toast.LENGTH_SHORT);
    toast.show();
    
    }
相關文章
相關標籤/搜索