Drjacky / ImagePicker

📸Image Picker for Android, Pick images from Gallery or Capture a new image with Camera🖼
https://github.com/Drjacky/ImagePicker
Apache License 2.0
230 stars 57 forks source link

ImagePicker dialog not showing in version 2.1.15 #66

Closed chayanforyou closed 2 years ago

chayanforyou commented 2 years ago

I'm using library version v2.1.15

implementation 'com.github.Drjacky:ImagePicker:2.1.15'

And my code is

binding.pickImage.setOnClickListener {
            ImagePicker.with(requireActivity())
                .crop()
                .cropOval()
                .maxResultSize(512, 512)
                .createIntentFromDialog { profileLauncher.launch(it) }
        }

Handling results

private val profileLauncher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
        if (it.resultCode == Activity.RESULT_OK) {
            val uri = it.data?.data!!
            val filePath = FileUriUtils.getRealPath(requireContext(), uri)
            Log.d("Path", filePath!!)
        }
    }

My ImagePicker dialog isn't showing. But if I downgrade the version to 2.1.14 its working fine.

yogeshreddoorz commented 2 years ago

I am also facing same issue on 2.1.15, I just changed 2.1.15 to 2.1.14 its working.

itzFaiz commented 2 years ago

This will work. Just add provider (ImageProvider.BOTH). Refer below


            ImagePicker.with(requireActivity())
                .crop()
                .cropOval()
                .maxResultSize(512, 512)
                .provider(ImageProvider.BOTH)
                .createIntentFromDialog { profileLauncher.launch(it) }
        } ```
Drjacky commented 2 years ago

It has been fixed on 2.1.16