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
New Developer
Posts: 12
Registered: ‎11-25-2008
My Device: Not Specified

Major Storm camera-bug/problem (JSR135)

[ Edited ]

Hi...

I programmed a JSR135 Testapplication (runs Fine on Bold -> Trackwheel =)   )

...so now I was porting it to the BB Storm...

Because there's no Trackwheel I have to use a menu...

Therefore I added a menu wich calls the method of the snapshot function.

 

Probleme:

-when pressing menu on storm the preview-screen is distorted

on Simulator: (1 is the image beforce, 2 is when pressing the menu)

--> Screenshot

 

Furthermore I another bug...(not reproducable on simulator)

Its like:

-see preview

-use menu and do scan (take snapshot, save byte[] -data)

-screen becomes black, "klick"-sound is played

---push a new screen for preview (add a bitmapfield)

---set the byte[]-data as bitmap to a bitmapfield (using Bitmap.createBitmapFromBytes)

-Snapshot is preview corectly (fullscreen)

-half second sleep

-Snapshot is previewed as a tiny thumbnail

-one second sleep

-and then its rotated by 90° and set to fullscreen

(without I do sth... as I already said.. it works fine on bold...)

 

 

The (trivial) CodeI'm using:

 

SETTINGS:
m_fIsViewfinderVisible = false;
m_oPlayer = Manager.createPlayer("capture://video");
m_oPlayer.realize();
m_oPlayer.prefetch();
m_oPlayer.start();
m_oVideoControl = (VideoControl) m_oPlayer.getControl("VideoControl");
m_oViewFinder = (Field) m_oVideoControl.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");
m_oVideoControl.setDisplayFullScreen(true);
this.add(m_oViewFinder);
m_oViewFinder.setFocus();
m_oVideoControl.setVisible(true);
m_fIsViewfinderVisible = true;

 

 

 

...thx a lot in advance! =)

Message Edited by chaoz1336 on 04-16-2009 11:01 AM
BlackBerry Development Advisor
Posts: 15,884
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Major Storm camera-bug/problem (JSR135)

You can sometimes see corruption of the camera preview screen in the BlackBerry Simulator.  This should not occur on a real BlackBerry handheld. 

 


chaoz1336 wrote:

---push a new screen for preview (add a bitmapfield)

---set the byte[]-data as bitmap to a bitmapfield (using Bitmap.createBitmapFromBytes)

-Snapshot is preview corectly (fullscreen)

-half second sleep

-Snapshot is previewed as a tiny thumbnail

-one second sleep

-and then its rotated by 90° and set to fullscreen


Can you elaborate on what is occuring here?  Is the preview the image that was captured, or are you refering to the camera preview window?  Is your application doing anything at this time?  Can you post some sample code that triggers this behaviour?  What BlackBerry handheld software version are you testing on?  You can find this under Options, About on the BlackBerry Smartphone.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
New Developer
Posts: 7
Registered: ‎06-18-2009
My Device: Not Specified

Re: Major Storm camera-bug/problem (JSR135)

Hi,

 

I am having the same problem. Here is my code:

 

This is the TakeSnapshot class which contains the code for taking the picture:

 

public class TakeSnapshot { private VideoControl vc; public Field initialize() { try { Player player = javax.microedition.media.Manager.createPlayer("capture://video"); player.realize(); player.start(); vc = (VideoControl) player.getControl("VideoControl"); Field field = (Field)vc.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field"); vc.setVisible(true); return field; } catch (Exception e) { Dialog.alert("Unable to initialize viewscreen.\nReason: "+e.getMessage()); } return null; } public byte[] snap() { try { String imageType = ConfigurationData.getInstance().getCurrentConfigurationItem().getSnapShotType(); if(imageType.equals("")) { // use default imageType = null; } return vc.getSnapshot(imageType); } catch (IllegalStateException e) { Dialog.alert("Unable to take snapshop.\nReason: Illegal State, "+e.getMessage()); } catch (MediaException e) { Dialog.alert("Unable to take snapshop.\nReason: Media, "+e.getMessage()); } catch (ControlledAccessException e) { Dialog.alert("Unable to take snapshop.\nReason: controlled access, "+e.getMessage()); } catch (SecurityException e) { Dialog.alert("Unable to take snapshop.\nReason: security, "+e.getMessage()); } return null; } public static Bitmap rotateImage(Bitmap oldB, int angle) throws Exception {

 

Here is how it is called in a FieldChangeListener used in the SnapShotScreen:

 

 

final class TakeSnapshotListener implements FieldChangeListener { private TakeSnapshot takeSnapshot; public TakeSnapshotListener(TakeSnapshot takeSnapshot) { this.takeSnapshot = takeSnapshot; } public void fieldChanged(Field field, int context) { byte[] imageBytes = this.takeSnapshot.snap(); SnapShotScreen screen = (SnapShotScreen)field.getScreen(); screen.setImageBytes(imageBytes); screen.close(); } }

 

Here is how the SnapShotScreen is created, displayed and how the byte[] is converted to bitmap, rotated and displayed:

 

 

public void fieldChanged(Field field, int context) { SnapShotScreen screen = new SnapShotScreen(); com.sessionTrak.SessionTrakUI.TheApp.pushModalScreen(screen); byte[] imageBytes = screen.getImageBytes(); Bitmap image = Bitmap.createBitmapFromBytes(imageBytes, 0, imageBytes.length, 4); Bitmap rotatedImage = image; try { rotatedImage = TakeSnapshot.rotateImage(image, 90); } catch (Exception e) { Dialog.alert("Unable to rotate image. Reason: "+e.getMessage()); rotatedImage = image; } PNGEncodedImage pngImage = PNGEncodedImage.encode(rotatedImage); this.bitmapField.setBitmap(rotatedImage); this.saveImageBytes(pngImage.getData()); }

 

Without rotating the image, it is display rotated to right 90 degrees.

 

Thank you for your help.

 

Jeff

New Developer
Posts: 7
Registered: ‎06-18-2009
My Device: Not Specified

Re: Major Storm camera-bug/problem (JSR135)

Oh, by the way.

 

I am tesing on a Blackberry Storm, OS version 4.7.0.148 (Platform 4.0.0.181)

 

Thanks.

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

Re: Major Storm camera-bug/problem (JSR135)

I have been able to reproduce this and have sent the issue to our development team.  The sample and/or BitmapField does not seem to take into account the orientation of the image.  Viewing the image in the BlackBerry Media Viewer does show the correct orientation.  I have sent this issue to our development team.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
New Developer
Posts: 7
Registered: ‎06-18-2009
My Device: Not Specified

Re: Major Storm camera-bug/problem (JSR135)

Is there a workaround that I can use? I currently have code to rotate bit by bit the image, but it is very, very slow.

 

Thanks.

New Developer
Posts: 2
Registered: ‎12-15-2009
My Device: Not Specified

Re: Major Storm camera-bug/problem (JSR135)

Hi,

 

I'm Having the same issue inside the app the image is rotated 90 deg anti-clockwise...looks like it's OS Bug. anybody has a quickfix please let me know....I'm already doing the rotation of image bytewise but it's very slow....Are der any reports from Blackberry regarding the issue.

 

Thank you,

Prabhu Devineni

New Developer
Posts: 7
Registered: ‎06-18-2009
My Device: Not Specified

Re: Major Storm camera-bug/problem (JSR135)

This is really ridiculous. Many of us have been waiting for an answer to this question from BlackBerry for quite a while. Why publish an API that is so broken?

 

It is obvious that the camara app does not do rotation, why do we have to????

 

This is a real drag on our applications!

 

Wake up someone there and tell us how to fix this problem.

Highlighted
Developer
Posts: 1,807
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.3.2.858, Z10 (STL100-3)-10.3.1.2576, Z30 (STA100-5)-10.3.1.2582, Passport (SQW100-1)-10.3.1.2576, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: Major Storm camera-bug/problem (JSR135)

Have you tried it on a device running OS 5.0? The issue might be fixed for that version of the OS.

 

The thing is most of the time issues like this don't show up, it's when someone comes across it that people make a post and it is brought up to RIM so they can work on it. The best way to track issues is with the Issue Tracker. Then not only is it available for RIM's development team to see and work on and you can see if they are willing to work on the issue or not.

 

As for this issue as MSohm said it has been brought up for the development team to work on.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.