开发者

What might cause a NullPointerException when running Camera.release()?

Android 2.1 - I'm trying to wo开发者_JAVA百科rk 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?


Are you sure that mCamera isn't null?

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


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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜