Android-image-cropper: result.getUri() is null in onCropImageComplete

Created on 3 Feb 2018  路  2Comments  路  Source: ArthurHub/Android-Image-Cropper

Hi , this is my implemention

caller :

Intent intent = new Intent(activity.getApplicationContext(), ImageCropperActivity.class);
intent.setData(imageUri);
activity.startActivityForResult(intent, requestCode);

cropper activity:

Intent intent = getIntent();
imageUri = intent.getData();
imgCropper.setImageUriAsync(imageUri);
imgCropper.setOnCropImageCompleteListener(this);

perform crop:

imgCropper.getCroppedImageAsync();

now in onCropImageComplete the result.getUri() is null, where is problem?

Most helpful comment

I changed

 imgCropper.getCroppedImageAsync();

to

imgCropper.saveCroppedImageAsync(Uri.fromFile(new File(SAVE_PATH)));

and problem solved, now in the setOnCropImageCompleteListener the result.getUri() is not null.

@ArthurHub I think it's better to write wiki more accurate, regards

All 2 comments

I changed

 imgCropper.getCroppedImageAsync();

to

imgCropper.saveCroppedImageAsync(Uri.fromFile(new File(SAVE_PATH)));

and problem solved, now in the setOnCropImageCompleteListener the result.getUri() is not null.

@ArthurHub I think it's better to write wiki more accurate, regards

If you look at the source code it says exactly what you did.

` /**
* The Android uri of the saved cropped image result Null if get cropped image was executed, no
* output requested or failure.
*/

public Uri getUri() {
return mUri;
}`

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  8Comments

key321 picture key321  路  9Comments

eugenio-caicedo picture eugenio-caicedo  路  4Comments

Ani24may picture Ani24may  路  5Comments

willemevenwel picture willemevenwel  路  7Comments