Dhaval2404 / ImagePicker

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

how to get intent in java? #245

Open shukiTSP opened 3 years ago

DevPraly commented 3 years ago

Hi, same issue here.

Added dependencies but can't figure how to write implementation to create the intent in JAVA.

Sample:

ImagePicker.with(this)
                .saveDir(requireActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES))
                .cameraOnly()
                // others configuration
                .createIntent(intent -> startForMediaPickerResult.launch(intent));
dulejo commented 2 years ago
ImagePicker.Companion.with(this)
                .cameraOnly()
                .crop(500, 500)
                .compress(1024)
                .createIntent(intent -> {
                    request.launch(intent);
                    return null;
                });

ImagePicker.Companion.with(this)
                .galleryOnly()
                .crop(500, 500)
                .compress(1024)
                .createIntent(intent -> {
                    request.launch(intent);
                    return null;
                });