02-16-2010 06:42 PM
i have an application that invokes the camera, uses a FileSystemJournalListener to retrieve the newly taken photo, and adds a thumbnail of that photo to the application screen that raised the invocation.
This is working all fine.
However, on occasion (and I cannot pinpoint exactly when or how) the debug screen reports "JPGDEC bad jpeg status 23".
I'm not sure what this means but it causes the image retreived to only show about half of the thumbnail after createBitmapFromBytes is called.
It also seems to only happen with certain images or images taken from the camera.
Any suggestions to what this is???
Solved! Go to Solution.
02-17-2010 01:50 PM
It sounds like your application has read in the JPEG file before it has been completely written out/saved by the camera application.
This is discussed here: http://supportforums.blackberry.com/t5/Java-Develo
02-17-2010 04:23 PM
Thanks for the quick response. The only real difference I saw was waiting a few seconds (which is what I suspected needed to happen). So I added a Thread.sleep(1800). I'm not sure that it actually sleeps that long but I haven't been able to reproduce the problem. Is there a way I can check? When I run the debug, it executes the Thread.sleep() method but continues on like any other line
Cheers
02-17-2010 05:57 PM
Talk about an ID 10 T error. I just realized that 1800ms is 1.8 secs so of course I wouldn't have been able to see alot of difference. I changed it to 2000 and just tested it out, it seems to be waiting 2 secs. Still haven't been able to reproduce the "bad jpeg status 23" error but I'm waiting for one individual to test on his device. He was the only one that was having the problem...I simulated with his device though.
02-18-2010 09:01 AM
Turns out that the Thread combined with checking if the image being taken was large fixed the problem. The Bitmap.creatBitmapFromBytes() was throwing an OutOfMemoryException. The user was taking photos in Large(2048x1068) resolution. I solved the problem by checking the length of bytes and setting a scale for the thumbnail. Thanks for the help.