Error with setParameters in camera code

All your problems with Audio, Video and Images.

Error with setParameters in camera code

Postby spengilley » Tue Nov 02, 2010 9:39 pm

Hi all,

I am trying to develop a small camera app. I am getting the following log errors when running the app on my phone


11-02 20:33:44.387: ERROR/AndroidRuntime(18165): Uncaught handler: thread main exiting due to uncaught exception
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): java.lang.RuntimeException: setParameters failed
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at android.hardware.Camera.native_setParameters(Native Method)
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at android.hardware.Camera.setParameters(Camera.java:627)
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at com.pengilleys.fishingsnapz.CameraView$1.surfaceChanged(CameraView.java:95)
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at android.view.SurfaceView.updateWindow(SurfaceView.java:460)
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at android.view.SurfaceView.dispatchDraw(SurfaceView.java:287)
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at android.view.ViewGroup.drawChild(ViewGroup.java:1583)
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1312)
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at android.view.View.draw(View.java:6538)
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at android.widget.FrameLayout.draw(FrameLayout.java:352)
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at android.view.ViewGroup.drawChild(ViewGroup.java:1585)
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1312)
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at android.view.ViewGroup.drawChild(ViewGroup.java:1583)
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1312)
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at android.view.View.draw(View.java:6538)
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at android.widget.FrameLayout.draw(FrameLayout.java:352)
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1866)
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at android.view.ViewRoot.draw(ViewRoot.java:1353)
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at android.view.ViewRoot.performTraversals(ViewRoot.java:1118)
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at android.view.ViewRoot.handleMessage(ViewRoot.java:1639)
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at android.os.Handler.dispatchMessage(Handler.java:99)
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at android.os.Looper.loop(Looper.java:123)
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at android.app.ActivityThread.main(ActivityThread.java:4595)
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at java.lang.reflect.Method.invokeNative(Native Method)
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at java.lang.reflect.Method.invoke(Method.java:521)
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
11-02 20:33:44.656: ERROR/AndroidRuntime(18165): at dalvik.system.NativeStart.main(Native Method)

My surfaceChanged code is as followed

public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {

Camera.Parameters p = mCamera.getParameters();
p.setPreviewSize(width,height);
p.setPictureFormat(PixelFormat.JPEG);
mCamera.setParameters(p);
mCamera.startPreview();
}

I also have the stock android example code and mine is almost the same (with the exception of my customisations) and this code DOESN'T error. I just can't see why though...
spengilley
Junior Developer
Junior Developer
 
Posts: 18
Joined: Tue Sep 07, 2010 9:14 pm

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 20 guests