03-29-2009 08:34 PM - edited 03-30-2009 06:20 AM
I've been trying to integrate a camera into an application that will only run on 9000 Bolds and 8900 Curves. My code which was based on this following KB article works absolutely fine on the Bold.
How To - Take a snapshot using the built-in camera of a BlackBerry smartphone
Article Number: DB-00667
However it doesn't work on the 8900 Curve. I've originally had a problem with the viewfinder only showing part of the image and then corrupting the display, so I upgraded the OS to v22.214.171.124 (the latest available for Vodafone UK) and now the Viewfinder is not shown at all.
To make sure it was not just my application, I loaded camerademo, compiled using JDE 4.6.1 and signed, onto the device. Again the Viewfinder Field is not shown. When I click on the 'Take Photo' button I get a null pointer exception, because the bytes (_raw) passed to the createImageScreen screen are null.
camerademo works fine on the simulator, but it is interesting on the simulator that the maximum camera resolution is 1660*1200, where as the real device is 2K * 1.5K.
So why is camerademo not working? If I can fix it, I think I can fix my application.
Edit to set "E-mail me" should anyone respond.
Solved! Go to Solution.
03-30-2009 12:52 PM
There is an issue with the BlackBerry handheld software that is preventing the VideoControl of the camera preview from being displayed when it does not have enough screen space to display itself in its full size (it fails when scrolling would be required).
On a BlackBerry Curve 8900 the field takes up the entire screen. You can work around this by removing all other fields from the screen that the camera preview VideoControl has been added to (this includes the title and status areas of MainScreen).
The null return value is a side affect of the VideoControl not being displayed. Once it is visible the image should be returned.
Our development team is aware of this issue.
03-30-2009 04:34 PM
I've changed the camerademo to remove everything from the screen and now I can see the view finder.
I've recoded the screen so that a trackball click will still fire the snapshot collection process. Unfortunately I get an exception when taking the snapshot. The line:
createImageScreen( _videoControl.getSnapshot( encoding ) );
Causes the following exception:
javax.microedition.media.MediaException: Unable to take picture
I done a search, and can't find anything that will gives me a clue as to what to do about this.
For the record, the encoding I used was:
I also tried with the highest resolution, i.e.
Is it possible for you to create a camerademo that actually works on this device?
03-30-2009 05:22 PM
03-30-2009 05:46 PM - edited 03-30-2009 05:52 PM
I have all permissions set to Allow.
I changed the Recording to Prompt, got the prompt, allowed it and then dead. Sorry didn't have the device connected at the time so can't guarantee it was the same error, but I would be reasonably confident it was.
If you are getting past this with a later level of OS, should I try that?
Edit: Apologies, I did not mention it, but once I get the Exception, the device is pretty well useless - the screen is locked on the still from the camera and I struggle to get it to accept anything. I just reboot.
04-02-2009 03:20 PM
This problem is now resolved with an OS upgrade to 126.96.36.199, form 188.8.131.52.
Even with this level, the CameraDemo screen of the camerademo, which contains the 'Viewfinder' must be changed so that no other Fields are used - this includes removing the the setTtitle. With this done, the ButtonField is not added, so its fieldChanged() event is not fired, so some other method of taking the picture must be used. In addition, I have also changed the scaling factor in the ImageScreen to 8 from 7, to make the thumbnail a bit smaller.
06-10-2010 08:24 AM
Can you provide the updated code if possible? I have tried it but its not working on Device even thogh it works fine on simulator. I does not get any kind of exception on device but when I click on Take photo (button I have used to take photo where I take videocontrol's object and take a snapshot) it shows the blank white screen . I m having the OS version 184.108.40.206 for 8900.
06-10-2010 09:18 AM
07-14-2010 10:11 AM
Sorry to post after so many days(I was working on some other tasks and this was in queue) but I have tried the above code and sorry to say but it also not working. I have tested this on 8900 simulator having 220.127.116.119 and 18.104.22.1685 os but still the view finder is blank.
Also FYI, when I test the same code on 22.214.171.124 simulator it works perfectly.