android-image-picker icon indicating copy to clipboard operation
android-image-picker copied to clipboard

Use case Java sample for 3.0.0-beta1

Open prosperz31 opened this issue 4 years ago • 6 comments

First thanks to the great work done on this ImagePicker.

As I do not know Kotlin at all, I have some difficulties to used your 3.0.0beta1.

Are you able to provide me with a sample in Java (particularly on the result callback)?

prosperz31 avatar Aug 12 '21 07:08 prosperz31

I have successfully used this Java code to instantiate ImagePicker in, Java in 3.0.0-beta1.

    launcherSessionImage = ImagePickerLauncherKt.registerImagePicker(
            EditSessionFragment.this,
            (List<Image> images) -> {
                for(Image image : images)
                {
                        // Actions
                }
                return null;
            });

But, if I try to migrate to 3.0.0-beta4, it not works (ERROR : Cannot resolve method 'registerImagePicker(fr.piscarius.piscarius.fragment.EditSessionFragment, )'). Is there a change in 3.0.0-beta4 ?

prosperz31 avatar Aug 14 '21 10:08 prosperz31

@prosperz31 did you got it working for 3.0.0-beta4 ?

jerinamathews avatar Nov 17 '21 11:11 jerinamathews

Unfortunately I found another library in final version allowing to use this.

I decided to stop using esafirm even if it stays a great ImagePicker ! It is just a personal choice.

prosperz31 avatar Nov 17 '21 11:11 prosperz31

Just to clearly answer to your question : I never get this working in beta4 ;)

prosperz31 avatar Nov 17 '21 11:11 prosperz31

I figured it out

      ImagePickerLauncher launcher = ImagePickerLauncherKt.registerImagePicker(this, ()->{return this;}, (List<Image> images) -> {
        for(Image image : images)
        {
            // Actions
            Log.e("IMG", String.valueOf(image));
        }
        return null;
    });

jerinamathews avatar Nov 17 '21 13:11 jerinamathews

I do not have any environment to check this. But it could be a good way.

prosperz31 avatar Nov 17 '21 13:11 prosperz31

@jerinamathews I am trying to make it work with Java code, using stable version 3.0.0. Tested the code snippet you shared, but it din't work ! image

Edit

Managed to make it work by replacing "()->{return this;}" with "()-> {return getContext();}", Iam executing the ImagePicker launcher from a Fragment.

MahmoudiOussama avatar Dec 01 '23 17:12 MahmoudiOussama