Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified
Accepted Solution

Camerademo does not work on 8900 Curve

[ Edited ]

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
http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/1089414/How_To...

 

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 v4.6.1.133 (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.

Message Edited by peter_strange on 03-30-2009 11:20 AM
BlackBerry Development Advisor
Posts: 15,727
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Camerademo does not work on 8900 Curve

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.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Camerademo does not work on 8900 Curve

Thanks Mark,

 

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:

encoding=jpeg&width=1024&height=768&quality=fine

 

I also tried with the highest resolution, i.e.

encoding=jpeg&width=2048&height=1536&quality=fine

 

Any suggestions? 

 

Is it possible for you to create a camerademo that actually works on this device?

 

BlackBerry Development Advisor
Posts: 15,727
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Camerademo does not work on 8900 Curve

I've done the same thing (although testing on a slightly newer version) and at that point I get a prompt requesting permission to take the picture (application control setting for recording).  Do you see that at all or is the exception thrown right away? 
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Camerademo does not work on 8900 Curve

[ Edited ]

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.

Message Edited by peter_strange on 03-30-2009 10:52 PM
Highlighted
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Camerademo does not work on 8900 Curve

This problem is now resolved with an OS upgrade to 4.6.1.199, form 4.6.1.133. 

 

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. 

Contributor
Posts: 37
Registered: ‎05-18-2010
My Device: 8350i
My Carrier: Sprint

Re: Camerademo does not work on 8900 Curve

Hi Peter,

 

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  4.6.1.133 for 8900.

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Camerademo does not work on 8900 Curve

I haven't tried it, but attached are the files I updated. 

 

Let me know how you get on. 

Contributor
Posts: 37
Registered: ‎05-18-2010
My Device: 8350i
My Carrier: Sprint

Re: Camerademo does not work on 8900 Curve

Hi Peter,

 

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 4.6.1.319 and 4.6.1.315 os but still the view finder is blank. 

 

Also FYI, when I test the same code on 4.6.1.92 simulator it works perfectly.

 

 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Camerademo does not work on 8900 Curve

Can you confirm the following.

 

The updated code works on your oldest 8900 Simualtor, but does not work on your newer ones.