将uri放入intent变量中,将其接收并放在imageview中

时间:2018-09-27 21:24:31

标签: android android-studio android-imageview android-image android-crop

我使用此功能裁剪图像:

private void performCrop(String picUri) {
    try {
        //Start Crop Activity

        Intent cropIntent = new Intent("com.android.camera.action.CROP");
        // indicate image type and Uri
        File f = new File(picUri);
        Uri contentUri = Uri.fromFile(f);

        cropIntent.setDataAndType(contentUri, "image/*");
        // set crop properties
        cropIntent.putExtra("crop", "true");
        // indicate aspect of desired crop
        cropIntent.putExtra("aspectX", 0);
        cropIntent.putExtra("aspectY", 0);
        // indicate output X and Y
        cropIntent.putExtra("outputX", 280);
        cropIntent.putExtra("outputY", 280);
        // retrieve data on return
        cropIntent.putExtra("return-data", true);
        // start the activity - we handle returning in onActivityResult
        startActivityForResult(cropIntent, RESULT_CROP);
    }
    // respond to users whose devices do not support the crop action
    catch (ActivityNotFoundException anfe) {
        // display an error message
        String errorMessage = "your device doesn't support the crop action!";
        Toast toast = Toast.makeText(this, errorMessage, Toast.LENGTH_SHORT);
        toast.show();
    }
}

现在我想做

将1个作物结果作为uri插入cropIntent变量

在onActivityResult中将作物结果2接收为uri

在图像视图上3次收到uri

我该怎么做?

0 个答案:

没有答案