• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps stack trace question.

Hello gurus,

I am trying to create a small app that uses the camera but when I try to setContentView() to another layout than the one with the SurfaceView used by th camera, an unhandled exception occurs which terminates the program. Here is the stack trace:
Code:
04-08 14:24:55.104: WARN/dalvikvm(328): threadid=1: thread exiting with uncaught exception (group=0x40015560)
04-08 14:24:55.194: ERROR/AndroidRuntime(328): FATAL EXCEPTION: main
04-08 14:24:55.194: ERROR/AndroidRuntime(328): java.lang.RuntimeException: Method called after release()
04-08 14:24:55.194: ERROR/AndroidRuntime(328):     at android.hardware.Camera.setHasPreviewCallback(Native Method)
04-08 14:24:55.194: ERROR/AndroidRuntime(328):     at android.hardware.Camera.access$600(Camera.java:114)
04-08 14:24:55.194: ERROR/AndroidRuntime(328):     at android.hardware.Camera$EventHandler.handleMessage(Camera.java:545)
04-08 14:24:55.194: ERROR/AndroidRuntime(328):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-08 14:24:55.194: ERROR/AndroidRuntime(328):     at android.os.Looper.loop(Looper.java:123)
04-08 14:24:55.194: ERROR/AndroidRuntime(328):     at android.app.ActivityThread.main(ActivityThread.java:3683)
04-08 14:24:55.194: ERROR/AndroidRuntime(328):     at java.lang.reflect.Method.invokeNative(Native Method)
04-08 14:24:55.194: ERROR/AndroidRuntime(328):     at java.lang.reflect.Method.invoke(Method.java:507)
04-08 14:24:55.194: ERROR/AndroidRuntime(328):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-08 14:24:55.194: ERROR/AndroidRuntime(328):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-08 14:24:55.194: ERROR/AndroidRuntime(328):     at dalvik.system.NativeStart.main(Native Method)
04-08 14:24:55.274: WARN/ActivityManager(61):   Force finishing activity net.stamoulis.frames/.main
I guess some callback is generated after I call Camera.stopPreview() and Camera.release() but I can't see where it is actually generated. So, is there a way to find out which of my methods generates the callback and in which thread is this taking place? I've tried android.os.Debug.startMethodTracing(); but the file dmtrace.trace that is generated is freaking empty!!!

Could anyone help me out with this?
I thank you in advance,
George.
 
Why are you setting a different contentView?
What do you mean by that? I am changing it because I need a new one... (eg: for the settings of the camera). Shouldn't I do that? Is there an other way like invalidating views and adding new ones or what?

Anyway, If you propose some other way to manipulate the contentView, it may be more efficient and I would like to know about it but I would be surprised if this is what is causing this specific error to me!

Cheers ;)
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones