My app uses the camera and shows a preview on screen using 
Camera#startPreview. If I switch to YouTube and start watching a video, and 
then switch back to the my app while the YouTube video is playing or even 
paused, it results in the exception shown below. I do release the camera in 
MyActivity#onPause and open it again on MyAcivity#onResume. This is on a 
Nexus S with Android 2.3.4. Any idea why this happens? YouTube does not use 
the camera at all, so why it it causing a problem for the my app? Also, the 
call to Camera#startPreview is preceeded by a call to Camera.open which does 
succeed.

Thanks
Shri

I/MyCameraApp( 1618): Calling Camera.open

I/MyCameraApp( 1618): Calling Camera#setParameters

W/CameraHardwareSec(   76): WARN(virtual android::status_t 
android::CameraHardwareSec::setParameters(const 
android::CameraParameters&)): request for preview frame 10 not allowed, != 
15

I/MyCameraApp( 1618): Setting camera preview size to 176 x 144

I/MyCameraApp( 1618): Device orientation is 0; camera orientation is 270

I/MyCameraApp( 1618): frameRotationBeforeDisplaying is 90; 
frameRotationBeforeSending is 270

I/MyCameraApp( 1618): Calling Camera#startPreview

E/SEC_Overlay(  107): Error - overlays already in use

W/CameraService(   76): Overlay create failed - retrying

E/SEC_Overlay(  107): Error - overlays already in use

W/CameraService(   76): Overlay create failed - retrying

E/SEC_Overlay(  107): Error - overlays already in use

W/CameraService(   76): Overlay create failed - retrying

E/SEC_Overlay(  107): Error - overlays already in use

W/CameraService(   76): Overlay create failed - retrying

E/SEC_Overlay(  107): Error - overlays already in use

...

E/SEC_Overlay(  107): Error - overlays already in use

W/CameraService(   76): Overlay create failed - retrying

E/SEC_Overlay(  107): Error - overlays already in use

W/CameraService(   76): Overlay create failed - retrying

E/CameraService(   76): Overlay Creation Failed!

D/AndroidRuntime( 1618): Shutting down VM

W/dalvikvm( 1618): threadid=1: thread exiting with uncaught exception 
(group=0x40015560)

E/AndroidRuntime( 1618): FATAL EXCEPTION: main

E/AndroidRuntime( 1618): java.lang.RuntimeException: startPreview failed

E/AndroidRuntime( 1618):  at android.hardware.Camera.startPreview(Native 
Method)

E/AndroidRuntime( 1618):  at 
com.shri.myapp.MyActivity.startCapturing(MyActivity.java:216)

E/AndroidRuntime( 1618):  at 
com.shri.myapp.MyActivity.surfaceChanged(MyActivity.java:328)

E/AndroidRuntime( 1618):  at 
android.view.SurfaceView.updateWindow(SurfaceView.java:549)

E/AndroidRuntime( 1618):  at 
android.view.SurfaceView.dispatchDraw(SurfaceView.java:348)

E/AndroidRuntime( 1618):  at 
android.view.ViewGroup.drawChild(ViewGroup.java:1644)

E/AndroidRuntime( 1618):  at 
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)

E/AndroidRuntime( 1618):  at android.view.View.draw(View.java:6883)

E/AndroidRuntime( 1618):  at 
android.view.ViewGroup.drawChild(ViewGroup.java:1646)

...

E/AndroidRuntime( 1618):  at 
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)

E/AndroidRuntime( 1618):  at android.view.View.draw(View.java:6883)

E/AndroidRuntime( 1618):  at 
android.widget.FrameLayout.draw(FrameLayout.java:357)

E/AndroidRuntime( 1618):  at 
com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1862)

E/AndroidRuntime( 1618):  at android.view.ViewRoot.draw(ViewRoot.java:1522)

E/AndroidRuntime( 1618):  at 
android.view.ViewRoot.performTraversals(ViewRoot.java:1258)

E/AndroidRuntime( 1618):  at 
android.view.ViewRoot.handleMessage(ViewRoot.java:1859)

E/AndroidRuntime( 1618):  at 
android.os.Handler.dispatchMessage(Handler.java:99)

E/AndroidRuntime( 1618):  at android.os.Looper.loop(Looper.java:130)

E/AndroidRuntime( 1618):  at 
android.app.ActivityThread.main(ActivityThread.java:3683)

E/AndroidRuntime( 1618):  at java.lang.reflect.Method.invokeNative(Native 
Method)

E/AndroidRuntime( 1618):  at 
java.lang.reflect.Method.invoke(Method.java:507)

E/AndroidRuntime( 1618):  at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)

E/AndroidRuntime( 1618):  at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)

E/AndroidRuntime( 1618):  at dalvik.system.NativeStart.main(Native Method)

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to