Since API 21 google recommend using the new android.hardware.camera2 I tried to find examples of using new API to create camera preview, but nothing was found. Can any body give me an example? Thanks so much!
↳ androidx.camera.core.Preview. A use case that provides a camera preview stream for displaying on-screen. The preview stream is connected to the Surface provided via SurfaceProvider . The application decides how the Surface is shown, and is responsible for managing the Surface lifecycle after providing it.
you can view this example may this will help you
Android Camera2Basic Sample
This sample demonstrates the basic use of Camera2 API. Check the source code to see how you can display camera preview and take pictures. Pre-requisites
Android SDK v21 Android Build Tools v21.1.1 Android Support Repository
https://github.com/googlesamples/android-Camera2Basic
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With