EasyCameraAndGallery | Android-Arsenal.com


Get PermissionHome CameraSelect photoSend result

Install

Support API 21 and above

Step 1. Add it in your root build.gradle at the end of repositories:

maven { url 'https://jitpack.io' }

Step 2. Add the dependency

implementation 'com.github.AlfredoHdez1709:EasyCameraAndGallery:{version}'

Basic implementation

Generate call result from an activity

returns a list with paths of captured or selected images (List)

    private lateinit var resultScan: ActivityResultLauncher<Intent>    private fun initCall() {        resultScan = registerForActivityResult(androidx.activity.result.contract.        ActivityResultContracts.StartActivityForResult()) { result ->                if (result.resultCode == Activity.RESULT_OK) {                    val list = result.data?.getStringArrayListExtra(EasyCamera.IMAGE_RESULTS)                    print(list)                }            }    }

Launch the camera send as parameter the context, options and result

EasyCamera.start(this, OptionsCamera(), resultScan)

Custom implementation

val optionsCamera = OptionsCamera(            count = 1,            path = "CustomFolder",            flash = Flash.Auto,            isFrontFacing = true,            ratio = Ratio.RATIO_16_9        )EasyCamera.start(this, optionsCamera, resultScan)
AttributesTypeNote
countIntNumber of captured images.
pathStringFolder where the images are saved. pictures/customFolder
flashFlashControl the flash of your implementation.
isFrontFacingBooleanTurn on the front camera by default.
ratioRationControl the dimensions of your captured image.

Thanks to

License

Licensed under MIT, click here for the full license.

Author & support

This project was created by AHRSOFT.

If you appreciate my work, consider buying me a cup of ☕ to keep me recharged ???? by PayPal



Source link

Post a Comment

Previous Post Next Post