Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem Calling CropImage.getActivityResult from Java #113

Closed
NmMedina opened this issue Apr 13, 2021 · 8 comments · Fixed by #125
Closed

Problem Calling CropImage.getActivityResult from Java #113

NmMedina opened this issue Apr 13, 2021 · 8 comments · Fixed by #125
Assignees

Comments

@NmMedina
Copy link

Hi there I'm coming from the old repository due I'm having problems with Android 11 when accepting the Photo but when I'm trying to get the result from the activity I can't get the result due it's not static, reviewing the Java version has the static modifier

@Nullable
public static ActivityResult getActivityResult(@Nullable Intent data) {
    return data != null ? (ActivityResult) data.getParcelableExtra(CROP_IMAGE_EXTRA_RESULT) : null;
}

but the kt file doesn't have the @JvmStatic

/**
 * Get [CropImageActivity] result data object for crop image activity started using [ ][.activity].
 *
 * @param data result data intent as received in onActivityResult(int, int, Intent).
 * @return Crop Image Activity Result object or null if none exists
 */
// TODO don't return null
fun getActivityResult(data: Intent?): ActivityResult? =
    data?.getParcelableExtra<Parcelable>(CROP_IMAGE_EXTRA_RESULT) as? ActivityResult?

Is the intended behavior? I cant figure out how to use that method, any advice will be welcome

image

@Canato
Copy link
Member

Canato commented Apr 13, 2021

Hello @NmMedina welcome to the lib

Please check this discussion

We add some @JvmStatic but look like we always need more.
So, before make n comments and releases for each method is better we do just one!

For this we need to add a Java Sample code, to be sure is working.

Please feel free to add the Java Sample and open a PR for it

@NmMedina
Copy link
Author

Hi, @Canato Thanks for the fast response! Perfect I going to work on this example and make a PR

@Canato
Copy link
Member

Canato commented Apr 13, 2021

Let this open, so people know you are working on this!

Will link with the discussion

@junaediwidjojo
Copy link
Contributor

Hello

I really need help on this, my codes is full on java so need this library working on java too.

What should I do to help you fix this bug?

I still new in PR that you mentioned, trying to push my sample in separate branch but not working.
Attached is my java sample code, hope you can help me to check it.
Uploading SExtendActivityJava.java.txt…

Thank you

@Canato
Copy link
Member

Canato commented May 5, 2021

Hey @junaediwidjojo thanks for being involved =D.

To add a PR you will need to create a fork form the repository and create the PR from your forkRepo to this repo.
On the top right corner of github you can see
Screenshot 2021-05-05 at 12 33 46

The latest button is the one you wanna.

Later you will be able to open a PR like this:
Screenshot 2021-05-05 at 12 36 41

As well, please take a read in the CONTRIBUTING GUIDE

For this work we need some stuffs:

  1. Java sample code using all methods, like we have in kotlin
  2. Add @JVMStatic where need

@Nuwisam
Copy link

Nuwisam commented May 7, 2021

meanwhile this is simple workaround:
data.getParcelableExtra(CropImage.CROP_IMAGE_EXTRA_RESULT)

@andre719mv
Copy link

andre719mv commented May 12, 2021

CropImage.getPickImageChooserIntent, getPickImageResultUri also can`t be called from Java

@Canato
Copy link
Member

Canato commented May 13, 2021

CropImage.getPickImageChooserIntent, getPickImageResultUri also can`t be called from Java

please open a PR or issue for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants