Monday, August 13, 2012

[android-developers] Re: Whats the best practices when using Camera

You may want to surround the block with an if statement.
if(camera != null)
{
camera.stopPreview();
                camera.release();
                camera = null;
}
 
 

On Tuesday, January 26, 2010 5:22:38 AM UTC-6, steve wrote:
Greetings,

I have an application that uses the camera quite heavily. I often find
when I move between activities that the camera is quite liable to
crash throwing the camera service is unavailable.

I was wondering if their is a 'best practices' approach to using the
camera service. I'm sure I am doing something wrong. In my surface
destroyed method I usually have the following


        public void surfaceDestroyed(SurfaceHolder holder) {
                // TODO Auto-generated method stub
                camera.stopPreview();
                camera.release();
                camera = null;
        }

Thanks for any tips

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment