Android camera locked after force close

前端 未结 4 1890
不思量自难忘°
不思量自难忘° 2020-12-16 17:29

I have an application where I use devices camera.

Now I only release camera in normal flow.

@Override
public void surfaceDestroyed(SurfaceHolder surf         


        
4条回答
  •  醉酒成梦
    2020-12-16 18:20

    Out of memory error comes because the image you tried to save exeeded the limit, normally comes when you try to process a bitmap.

    You can try these methods to avoid camera getting not released.

    Camera myCamera;

    Use logs and fing where the error occurs and Add a try catch block and in the catch block add myCamera.stopPreview(); and myCamera.release(); Also override the ondestroy and onpause method and add myCamera.stopPreview(); and myCamera.release();

    Hope this helps you or atleast gave you an idea.

提交回复
热议问题