Strange camera behaivor

TrisectDevelopment

Active Member
Licensed User
Longtime User
In my App I use the internal camera and it works fine on my LG Optimus One.
But a friend of mine has a SE Experia X10 and he gets an error everytime he tries to take a picture.

I put in a Try-Catch and Msgbox(LastException, "Error") in the take picture method.

He says the error is "The program has stopped unexpected# or something like that. (Its in danish)

What can I do?
 

agraham

Expert
Licensed User
Longtime User
Get a stack trace and write it to a file to see where it's happening. In my Threading library there is an ExceptionEx object that has a StackTrace property. Look at btnError_Click in the demo.
B4X:
   Dim Ex As ExceptionEx
   Try
      ...
   Catch
      Ex = LastException
      msg = Ex.StackTrace
      Msgbox(msg, "Error")
      ' write msg to a file or do whatever you want to do with it.
   End Try
Post the stack trace here if you need help interpreting it.
 
Upvote 0

TrisectDevelopment

Active Member
Licensed User
Longtime User
The log file

Heres the log file:

B4X:
06-16 18:49:54.139 I/ActivityManager( 1149): Displayed activity dk.trisect.MineTing/.main: 515 ms (total 515 ms)
06-16 18:49:55.239 D/dalvikvm( 1222): GC freed 894 objects / 61448 bytes in 66ms
06-16 18:50:03.289 I/ASK_KeySwitcher( 1222): Request for nextAlphabetKeyboard, but the keyboard-switcher is locked! Returning Symbols
06-16 18:50:03.369 D/dalvikvm( 5056): GC freed 6807 objects / 428336 bytes in 46ms
06-16 18:50:03.389 I/global  ( 5056): Default buffer size used in BufferedOutputStream constructor. It would be better to be explicit if an 8k buffer is required.
06-16 18:50:03.399 I/global  ( 5056): Default buffer size used in BufferedOutputStream constructor. It would be better to be explicit if an 8k buffer is required.
06-16 18:50:05.069 D/dalvikvm( 1752): GC freed 1022 objects / 54232 bytes in 36ms
06-16 18:50:07.149 D/CameraService( 1083): CameraService::connect E (pid 5056, client 0xf4980)
06-16 18:50:07.149 D/CameraService( 1083): Client::Client E (pid 5056)
06-16 18:50:07.279 D/CameraService( 1083): Client::Client X (pid 5056)
06-16 18:50:07.279 D/CameraService( 1083): CameraService::connect X
06-16 18:50:07.289 D/CameraService( 1083): stopPreview (pid 5056)
06-16 18:50:07.289 D/CameraService( 1083): stopPreview(), hardware stopped OK
06-16 18:50:07.289 D/AndroidRuntime( 5056): Shutting down VM
06-16 18:50:07.289 W/dalvikvm( 5056): threadid=3: thread exiting with uncaught exception (group=0x4001b160)
06-16 18:50:07.289 E/AndroidRuntime( 5056): Uncaught handler: thread main exiting due to uncaught exception
06-16 18:50:07.289 E/AndroidRuntime( 5056): java.lang.NoSuchMethodError: android.hardware.Camera.setDisplayOrientation
06-16 18:50:07.339 D/dalvikvm( 5056): GC freed 13790 objects / 654112 bytes in 50ms
06-16 18:50:07.349 E/SemcCheckin( 5056): Get crash dump level : java.io.FileNotFoundException: /data/semc-checkin/crashdump
06-16 18:50:07.349 W/ActivityManager( 1149): Unable to start service Intent { act=com.sonyericsson.android.jcrashcatcher.action.BUGREPORT_AUTO cmp=com.sonyericsson.android.jcrashcatcher/.JCrashCatcherService (has extras) }: not found
06-16 18:50:07.349 I/Process ( 1149): Sending signal. PID: 5056 SIG: 3
06-16 18:50:07.349 I/dalvikvm( 5056): threadid=7: reacting to signal 3
06-16 18:50:07.359 I/dalvikvm( 5056): Wrote stack trace to '/data/anr/traces.txt'
06-16 18:50:07.379 E/SemcCheckin( 1588): Get Crash Level : java.io.FileNotFoundException: /data/semc-checkin/crashdump
06-16 18:50:07.619 D/iddd-events( 1088): Registering event com.sonyericsson.idd.probe.android.devicemonitor::ThirdPartyCrash with 4311 bytes payload.
06-16 18:50:09.242 I/Process ( 5056): Sending signal. PID: 5056 SIG: 9
06-16 18:50:09.249 I/WindowManager( 1149): WIN DEATH: Window{45b63c88 dk.trisect.MineTing/dk.trisect.MineTing.main paused=false}
06-16 18:50:09.249 I/ActivityManager( 1149): Process dk.trisect.MineTing (pid 5056) has died.
06-16 18:50:09.249 I/UsageStats( 1149): Unexpected resume of com.android.launcher while already resumed in dk.trisect.MineTing
06-16 18:50:09.249 I/WindowManager( 1149): WIN DEATH: Window{45bbba70 SurfaceView paused=false}
06-16 18:50:09.269 D/CameraService( 1083): Client::~Client E (pid 1083, client 0xf4980)
06-16 18:50:09.289 E/FaceDetectCameraService( 1083): FaceDetectCameraService::relInstance Instance was already deleted.
06-16 18:50:09.289 D/CameraService( 1083): Client::disconnect() E (pid 1083 client 0xf4980)
06-16 18:50:09.289 D/CameraService( 1083): hardware teardown
06-16 18:50:09.289 W/CameraService( 1083): Client::disconnect(): Camera force closed
06-16 18:50:09.329 D/CameraService( 1083): removeClient (pid 1083): no more strong reference
06-16 18:50:09.329 D/CameraService( 1083): Client::disconnect() X (pid 1083)
06-16 18:50:09.329 D/CameraService( 1083): Client::~Client X (pid 1083)
06-16 18:50:09.379 D/dalvikvm( 1314): GC freed 952 objects / 71128 bytes in 41ms
06-16 18:50:09.419 W/InputManagerService( 1149): Got RemoteException sending setActive(false) notification to pid 5056 uid 10091
06-16 18:50:09.419 I/ASK     ( 1222): onUnbindInput
06-16 18:50:10.809 I/ActivityManager( 1149): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=ukzzang.android.app.logviewer/.act.MainAct }
06-16 18:50:11.429 I/ActivityManager( 1149): Displayed activity ukzzang.android.app.logviewer/.act.MainAct: 570 ms (total 570 ms)
06-16 18:50:11.459 I/ASK     ( 1222): onUnbindInput
06-16 18:50:16.709 D/dalvikvm( 1314): GC freed 594 objects / 56368 bytes in 50ms
06-16 18:50:27.429 D/dalvikvm( 1149): GC freed 30346 objects / 1731576 bytes in 102ms

I cant see whats happening, but maybe you can!
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
Unfortunately there is no stack trace information in there so we can't tell which line of code does the damage. However this looks like a possible reason.
06-16 18:50:07.289 E/AndroidRuntime( 5056): java.lang.NoSuchMethodError: android.hardware.Camera.setDisplayOrientation
I assume that you are using the Advanced Camera Library. This uses setDisplayOrientation in OriPortrait and OriLandscape so it looks like the device may not support this.
 
Upvote 0

TrisectDevelopment

Active Member
Licensed User
Longtime User
I don't think I'm using advanced camera library.

I tried my app on my wifes Desire S and on that I get an error on this line.

Dim tmpBmp as Bitmap
tmpBmp = LoadBitmap(File.DirRootExternal, viewImage)

viewImage is correct (pic0.png) and the file exist.

Maybe its the same on my friends Experia?
 
Last edited:
Upvote 0

agraham

Expert
Licensed User
Longtime User
No, it's an exception in the camera service that is killing your app in that log.

ActivityManager( 1149): Process dk.trisect.MineTing (pid 5056) has died.
Notice the process ID of 5056 for your app. It's the same process ID that suffers the uncaught exception. If you are not using the Advanced Camera Library I have no idea where that call to setDisplayOrientation can occur.
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
Upvote 0

TrisectDevelopment

Active Member
Licensed User
Longtime User
Yes I got it in front of me and it gives an error on this line.

Dim tmpBmp as Bitmap
tmpBmp = LoadBitmap(File.DirRootExternal, viewImage) <===

It's like it cannot load the bitmap and it dooes exist I have code that checks if it exists before I try to load.

It works perfectly on my LG Optimus One, strange.
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
Can you connect the Desire to the IDE with USB or B4A-Bridge and look at the Log output when it crashes? If it doesn't show a stack trace then get one like I said in my first post.

If you can catch the exception on the Experia then again get a stack trace like I said in my first post. This may not help a lot as I think the exception is thrown on a different thread so the stack trace may not be that of the actual exception but its worth a go. However it looks like a "feature" of the Experia as the library author suffers it as well!
 
Upvote 0

TrisectDevelopment

Active Member
Licensed User
Longtime User
This is was is logged:

B4X:
PackageAdded: package:dk.trisect.MineTing
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Installing file.
PackageAdded: package:dk.trisect.MineTing
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize2(CanvasWrapper.java:493)
anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize(CanvasWrapper.java:484)
dk.trisect.MineTing.main._btnret_click(main.java:641)
java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:507)
anywheresoftware.b4a.BA.raiseEvent2(BA.java:104)
anywheresoftware.b4a.BA.raiseEvent2(BA.java:92)
anywheresoftware.b4a.BA.raiseEvent(BA.java:88)
anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:49)
android.view.View.performClick(View.java:2532)
android.view.View$PerformClick.run(View.java:9277)
android.os.Handler.handleCallback(Handler.java:587)
android.os.Handler.dispatchMessage(Handler.java:92)
android.os.Looper.loop(Looper.java:143)
android.app.ActivityThread.main(ActivityThread.java:4196)
java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:507)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
dalvik.system.NativeStart.main(Native Method)

And yes I'm using CameraPortrait but not advanced.
 
Last edited:
Upvote 0

TrisectDevelopment

Active Member
Licensed User
Longtime User
I'm about to give up!!

It works like a charm on my LG Optimus One but like crap on those other two.

And the funny part on the Desire is this:
B4X:
fileName = liBilleder.Get(i)       '** Get a filename from list
listImage.Initialize(File.DirRootExternal, fileName)  '** listImage is a Bitmap
This code works.

B4X:
fileName = liBilleder.Get(ValgtPosition)  '** Get a filename from list
retImage.Initialize(File.DirRootExternal, fileName)  '** retImage is a Bitmap
This code throws an exception and crash the program.

To me they look the same!!!

The variable fileName get the right value from the list.
 
Upvote 0
Top