tags:

views:

31

answers:

2

Android 2.1 - I'm trying to work with the Camera via a widget.

My widget sets up and calls mCamera = Camera.open();, I can do everything with the camera, but when I go to release the camera via a 2nd widget click, mCamera.release(); throws a NullPointerException.

How much I find out why that is?

A: 

Are you sure that mCamera isn't null?

That's the only reason I can imagine why that specific statement would return a NullPointerException

Nicholas
A: 

That's exactly what it was. I was inadvertently re-initializing mCamera every time the Service ran. Put it further up stream and now it works wonderfully!

John
Was just typing out what to look for, but I'm much happier that you found it yourself. Learning is always great :D
JBirch