I am trying to crop my images as a circle, for this I am using the provided library of Android-Image-Cropper - 'com.theartofdev.edmodo:android-image-cropper:2.4.+' At the moment I am able to choose an image, the crop window appears as a circle, although it doesnt then crop to a circle but instead a square.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == GALLERY_REQUEST && resultCode == RESULT_OK) {
Uri imageUri = data.getData();
CropImage.activity(imageUri)
.setAspectRatio(150,150)
.setGuidelines(CropImageView.Guidelines.ON)
.setCropShape(CropImageView.CropShape.OVAL)
.start(this);
}
if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
CropImage.ActivityResult result = CropImage.getActivityResult(data);
if (resultCode == RESULT_OK) {
mImageUri = result.getUri();
mSetupImageBtn.setImageURI(mImageUri);
} else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
Exception error = result.getError();
}
}
}