Dhaval2404 / ImagePicker

📸Image Picker for Android, Pick an image from Gallery or Capture a new image with Camera
Apache License 2.0
1.53k stars 341 forks source link

Not able to use registerForActivityResult in java file #279

Open Rohitsachdeva opened 2 years ago

Rohitsachdeva commented 2 years ago

how to use this code in java file

ImagePicker.with(this) .compress(1024) //Final image size will be less than 1 MB(Optional) .maxResultSize(1080, 1080) //Final image resolution will be less than 1080 x 1080(Optional) .createIntent { intent -> startForProfileImageResult.launch(intent) }

antaki93 commented 2 years ago

Try this:

ImagePicker.with(activity)
                .compress(1024)
                .maxResultSize(1080, 1080)
                .createIntent( intent -> {
                    startForProfileImageResult.launch(intent);
                    return Unit.INSTANCE;
                });