I have come across two ways for custom camera implementation in android. First way is to use the deprecated camera 1 api second is to use the latest updated camera 2 api which does not seem to have a back port for devices below api 21 (Lolipop). My application supports API 18 minimum. Is there any way of doing it without using both api's and providing version checks.
I think you can use below custom camera api for your requirement.
gradle file:
compile 'com.otaliastudios:cameraview:1.4.1'
custom camera view set like:
<com.otaliastudios.cameraview.CameraView
android:id="@+id/camera"
android:keepScreenOn="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
for full support you can use below link:
https://github.com/hyl87/CameraView-1
i hope it will help you