Closed theanilpaudel closed 4 years ago
I have written the code like below
fun showPhotoPickerFragment() { PhotoPickerFragment.newInstance( multiple = false, allowCamera = true, theme = R.style.ChiliPhotoPicker_Light ).show(requireActivity().supportFragmentManager, "UploadProfileFragment") }
override fun onImagesPicked(photos: ArrayList<Uri>) { val initialPath = photos.get(0).path if (initialPath?.contains("emulated")!!) { imagePath = initialPath } else { imagePath = "/data/data/${requireActivity().packageName}/cache" + initialPath } println("onImagesPicked $imagePath") val file = File(imagePath) Picasso.with(requireContext()).load(file).into(binding.ivProfilePic) }
In the Application class, I am initializing like this ChiliPhotoPicker.init(loader = PicassoImageLoader(), authority = "$packageName.fileprovider")
ChiliPhotoPicker.init(loader = PicassoImageLoader(), authority = "$packageName.fileprovider")
When I run the code, the Picker appears but when I select a image the onImagePicked callback is never called.
onImagePicked
Stupid mistake,
I added childFragmentManager instead of requireActivity().supportFragmentManager and it is working fine.
childFragmentManager
requireActivity().supportFragmentManager
I have written the code like below
In the Application class, I am initializing like this
ChiliPhotoPicker.init(loader = PicassoImageLoader(), authority = "$packageName.fileprovider")
When I run the code, the Picker appears but when I select a image the
onImagePicked
callback is never called.