开发者

Quickly stopping camera on Android

I have a Live Wallpaper which uses the Camera. However, when running the LW I am unable to use any camera apps. The app starts, pauses then returns to the desktop. Logcat suggests that the problem is that the Camera App (and video camera app. 开发者_如何学运维and Qik etc.) are trying to open the camera and failing to do so. The LW is releasing the camera when visibility is false, but it seems that it is not quick enough.

Is there any way of speeding this up so that the standard camera apps are still usable?


Lyndon,

I know it's been a long time since you've asked your question, but I came across this and thought it might help you. Rather than trying to quickly unload the camera before the other app starts, try using

camera = Camera.open();
camera.unlock();

right after you first aquire the camera by using open()

What I believe this does is it releases the camera so that it can be used by other apps, which should do the trick for you. If you do that, your app can take its time closing the camera because it doesn't prevent the other from using the camera. :-)

I hope that helps! :-)

Here's a link for further information: http://developer.android.com/reference/android/hardware/Camera.html#unlock()

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜