Android News

Android Arsenal-camera

Obtain a license Home Camera Select a photo Send results

Install

support API 21 And above

Step 1. Add it to root build.gradle at the end of the repository:

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

Step 2. Add dependencies

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

Basic implementation

Generate call results from activity

Returns a list of paths (lists) with captured or selected images

    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)
                }
            }
    }

Start the camera as parameter to send context, options and results

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)
property type notes
Count int Number of images captured.
Small road Thin rope The folder where the image is saved. Pictures/custom files
flash flash Control the flash implemented.
iSfrontfacing Boole The front camera is turned on by default.
ratio rationing Controls the size of the captured image.

because

license

Get a license under MIT, click here to get the full license.

Author and Support

The project was created by Ahrsoft.

If you appreciate my work, please consider giving me a glass☕ to recharge me? ? ? ? By PayPal

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button