How to use this Imagepicker in fragment?
See original GitHub issuePlease give some example code to use imagepicker in fragment class. I got error:
ImagePicker.with(this)
.crop() //Crop image(Optional), Check Customization for more option
.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)
.saveDir(getExternalFilesDir(Environment.DIRECTORY_PICTURES))
.start();
I got error on (this) that means it is not recognizing (this) and also getExternalFilesDir(). I think it is because we have to pass activity but we are in fragment.
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (1 by maintainers)
Top Results From Across the Web
Selecting Image from gallery using fragment - android
I am trying to get image from gallery using fragment which is called from fragmentactivity but onActivityResult of the fragment class is not ......
Read more >com.esafirm.imagepicker.features.ImagePickerFragment java ...
Best Java code snippets using com.esafirm.imagepicker.features.ImagePickerFragment (Showing top 20 results out of 315) · ImagePickerActivity.onBackPressed().
Read more >Android Image Picker using Camera and Gallery. - Medium
Android Image Picker using Camera and Gallery. Implementation Utility of Custom ... Camera Fragment for Implement Camera using Camera X.
Read more >ImagePicker - Akshay Kale
ImagePicker. Android ImagePicker library use to choose images from Gallery and also provide an option to capture image from camera.
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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It works fine in my app.
Config:
In your fragment
Create an activity result launcher:
Pick image
i have the same issue, do you have a resolution?