Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Calling ImagePciker from a Fragment

See original GitHub issue

Hi Dhaval2404, I am having an issue while fetching the result of the data from ImagePciker. I am using it in java and not kotlin. As you know that onActivityResult() is deprecated in fragments so its troublesome to receive the data in it. I am able to receive the data in Activity level so I know its working! I just want to know if using ActivityResultLauncher whats the parameter i need to pass inside createIntent() of image picker for java.

ImagePicker.with(this) .compress(1024) .maxResultSize(1080, 1080) .createIntent { intent -> startForProfileImageResult.launch(intent) }

How to resolve that lamba function for java since activityResultLauncher needs an intent to fire up. I really want to implement this ImagePicker in my project since its so enticing. Any help would suffice.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:19

github_iconTop GitHub Comments

alankkocommented, Jul 28, 2021

This works for me.

ImagePicker.Builder with = ImagePicker.with(this);
       with.maxResultSize(1080, 1080);
       with.createIntent(new Function1<Intent, Unit>() {
           public Unit invoke(Intent Intent) {
               startForProfileImageResult.launch(Intent );
               return null;
nguyencongbinhcommented, Jul 9, 2021
                .createIntent(intent -> {

I got the same problem too on Java. Missing return statement. Please kindly help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Calling image picker intent from a fragment - android
the proper way to do this is create a callback to the activity where the method sends the intent to start the imagepicker...
Read more >
com.esafirm.imagepicker.features.ImagePickerFragment java ...
How to use. ImagePickerFragment. in. com.esafirm.imagepicker.features. Best Java code snippets using com.esafirm.imagepicker.features.ImagePickerFragment ...
Read more >
Android Image Picker using Camera and Gallery. - Medium
Calling method to upload selected image on Firebase storage. viewModel. ... Camera Fragment for Implement Camera using Camera X.
Read more >
Taking Pictures In An Android Fragment Using Intents - AirPair
5 Capturing Activity Results In Fragments ... I next want to draw your attention to these lines: Uri fileUri = Uri.fromFile(photoFile); activity.
Read more >
ImagePicker - Akshay Kale
ImagePicker view can be loaded directly as a DialogFragment. // instantiate the ImagePicker dialog fragment ImagePickerFragment ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found