简体   繁体   中英

Unable to create a surfaceview camera app that supports android 4.0 and above.

I'm planning to make a camera app that you can take a photo with a background image. I guess there will be a need to use a Surfaceview? But the main problem is since the Camera is deprecated there might be a need to use camera2 for android. I want to make a camera app in portrait mode but are there any samples or tip? I googled but wasn't able to find a decent one. I would love to hear from you.

If you want to start with Camera2 API, this link will help you understand basics.

android-Camera2Basic(Github)


It is not necessary to use SurfaceView as you will see from code that TextureView can also fulfill your requirement

The HdrViewfinder sample app uses SurfaceView with camera2, though it doesn't lock itself into portrait mode. But that's a relatively simple change.

Of course, camera2 was only added in Android 5.0, so if you need to support 4.0, you need to use the old camera API.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM