PDA

View Full Version : Problem to take a snapshot using the built-in camera


egirotto
07-05-2009, 02:54 PM
Hi,

i try to take a snapshot using the built-in camera.
I use the sample of Developers Knowledge Base (Livelink - Redirection (http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/1089414/How_To_-_Take_a_snapshot_using_the_built-in_camera_of_a_BlackBerry_smartphone.html?nodeid=1443849&vernum=0))
but it not work.
The problem is that the Field viewfinder not work in not full size mode.
I try to load the sample on my blackberry bold and i can't view the viewfinder until i use displayFullSize().
The code is exactly the same of the downloaded sample and in the simulator work (but the simulator ask for a static image).
Anyone do this?
This is the code (i post only the code of field):

...
private MenuItem mi = new MenuItem("Viewfinder", 1, 1) {
public void run() {
try {
setupEncoding();
logField.setText("");
log("Active Encoding: "+encoding);
if(vc!=null){
UiApplication.getUiApplication().invokeLater(new Runnable(){
public void run(){
if(home.getFieldCount()<3){
home.delete(logField);
home.add(viewFinder);
home.add(logField);
viewFinder.setFocus();
}

}
});
vc.setVisible(true);
isViewfinderVisible=true;
log("Initialized ViewFinder");
}else {
log("VideoControl not initialized");
}

} catch (Throwable e) {
log(e + ":" + e.getMessage());
}
}
};
...
public SnapShotAPI(){
home = new MainScreen();
logField = new EditField("Log:","");
bitmapField = new BitmapField();
String[] choices = {"SuperFine 1600x1200", "Fine 1600x1200", "Normal 1600x1200", "SuperFine 1024x768", "Fine 1024x768", "Normal 1024x768", "SuperFine 640x480", "Fine 640x480", "Normal 640x480"};
qualityField = new ObjectChoiceField("Quality", choices);
home.add(qualityField);
home.add(logField);
home.addMenuItem(mi);
home.addMenuItem(mi1);
home.addMenuItem(mi2);
home.addMenuItem(mi3);
preview = new MainScreen();
preview.add(bitmapField);

pushScreen(home);
try{
p = Manager.createPlayer("capture://video");
p.realize();
log("Player realized");
p.prefetch();
log("Player prefetched");
p.start();
log("Player started");
vc = (VideoControl) p.getControl("VideoControl");
viewFinder = (Field)vc.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");
log("Initialized.");
} catch (Exception me){
log(me.getMessage());
}
isViewfinderVisible=false;
}


Thank for help

egirotto
07-05-2009, 03:18 PM
hi, sorry for repeated question:
I just find this that explain that it not work on 8900 Curve.
Camerademo does not work on 8900 Curve - Java Development - BlackBerry Support Community Forums (http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=27272)

I post it for future askers ;)

Bye