简体   繁体   中英

How to write onPause() and onResume() method for Camera preview using Texture View

I copied an android custom camera making code. I used camera api 1 and TextireView for layout.

I'm stuck in onPause() and onResume() method, any suggestion to handle this methods . Other methods like onSurfaceTextureUpdated() are ok. But because of pause and resume the original phone camera app stops, saying camera not available. I don't want to use surfaceView and surfac holder for camera implementation.

You just need to make sure in your Activity that is using the Camera that in the onPause() method you release the camera. In the onResume method is where you should start the Camera. These two events should be completely independent of your method of displaying the preview really.

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