ArthurHub / ArthurHub/Android-Image-Cropper

getContext might be null after using crop image for fragment

Open
#526 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
6.4k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);

if (requestCode == GALLERY_PIC && resultCode == RESULT_OK) {
Uri imageUri = data.getData();

// start cropping activity for pre-acquired image saved on the device
CropImage.activity(imageUri)
.setAspectRatio(1, 1)
.start(getContext(), ProfileFragment.this);

Argument 'getContext()' might be null

if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
Condition 'requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE' is always 'false

CropImage.ActivityResult result = CropImage.getActivityResult(data);
if (resultCode == RESULT_OK) { }
else if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
Exception error = result.getError();
Toast.makeText(getActivity() , "Error" + error , Toast.LENGTH_SHORT).show();
}

I am not able to upload an image to firebase database. I think it might be because of 2 warning
1. Argument 'getContext()' might be null
2. Condition 'requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE' is always 'false

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.