简体   繁体   中英

Android camera SurfaceView alternative

I develop simple camera app for android devices 2.1 and later. I use standard way to show preview layer from camera using SurfaceView and SurfaceHolder. But I know about camera issue on 2.1 that camera preview displays properly only in landscape mode. But I need portrait mode only in my app. Is there another ways/libs to show user preview from camera on 2.1 and later. Thanks.

You can add a listener to the Camera.onPreviewDisplay callback, thus intercepting the generated frames. At this point with the given byte[] of data containing your pixels, you can do pretty much whatever you want. For example you can apply your own processing algorithm to the pixels and then draw the image to whatever ImageView or TextureView (since API 11) that you want.

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