0

i crop images using this function:

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();
    }
}

now i want to do:

1-insert crop result as uri in cropIntent variable

2-receive cropresult as uri in onActivityResult

3-put received uri on image view

How i can do it?

Mehrdad
  • 92
  • 1
  • 12
  • 1
    [Android does not have a `CROP` `Intent`](https://commonsware.com/blog/2013/01/23/no-android-does-not-have-crop-intent.html). There are many [image cropping libraries for Android](https://android-arsenal.com/tag/45). Please use one. – CommonsWare Sep 27 '18 at 21:28
  • cropintent is the name of variable.i use this function and receive data in bitmap now want to receive them as uri – Mehrdad Sep 27 '18 at 21:35
  • I am referring to `new Intent("com.android.camera.action.CROP")`. Not all Android devices have an activity that supports this undocumented and unsupported `Intent`. – CommonsWare Sep 27 '18 at 21:36
  • at this time it's not important...by the way do you know how i can receive data as uri? – Mehrdad Sep 27 '18 at 21:40
  • Since this `Intent` is undocumented and unsupported, you have no control over what it does, if anything. This is why programmers use one of the many [image cropping libraries for Android](https://android-arsenal.com/tag/45), as many of them *are* documented and *are* supported, in addition to working the same across all deviecs. – CommonsWare Sep 27 '18 at 21:50

0 Answers0