BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 01-06-2010, 07:28 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Mar 2007
Location: India
Model: 8100
Carrier: Airtel
Posts: 64
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question Display.screenshot(Bitmap) returns blank screen

Please Login to Remove!

Hello All,


I am developing an application which uses camera (VideoControl and Player).


Here I am pasting my code


String encoding = "encoding=video/3gpp&mode=standard";
_player = Manager.createPlayer("capture://video?"+encoding);
_player.realize();

_videoControl = (VideoControl)_player.getControl("VideoControl");
if(_videoControl != null){
Field videoField = (Field) _videoControl.initDisplayMode(VideoControl.USE_GUI _PRIMITIVE, "net.rim.device.api.ui.Field");
add(videoField);
btnStart = new ButtonField("Get Snap", ButtonField.CONSUME_CLICK | ButtonField.FIELD_HCENTER);
add(btnStart);
_videoControl.setVisible(true);
btnStart.setChangeListener(this);
_player.start();
}

On click event of a buutonField btnStart I am calling this

public void fieldChanged(Field field, int x) {
Bitmap bmp = null;
VerticalFieldManager vfmMain = new VerticalFieldManager(
VerticalFieldManager.VERTICAL_SCROLL | VerticalFieldManager.VERTICAL_SCROLLBAR);
while (snapCounter < 20) {
bmp = new Bitmap(Display.getWidth(), Display.getHeight());
Display.screenshot(bmp);
vfmMain.add(new BitmapField(bmp));
bmp = null;
snapCounter++;
Thread.sleep(100);
}
}


he bitmap I get includes the pictures seen in the camera too.



But this works for fine when i launch application for the first tiem after installing it in device. When I exit application and again launch it it gives screen but without any camera pictures. I want the image with the camera pictures.


Please anybody knows why it is happening. And Is there any solution for this.


Thanks
__________________
Crazy for BlackBerry

Last edited by renuka_anil : 01-06-2010 at 09:10 AM. Reason: pasted code snippet
Offline  
Old 01-11-2010, 10:05 AM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: Mar 2007
Location: India
Model: 8100
Carrier: Airtel
Posts: 64
Post Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up

For this Best prectice is to use playerListener and overrride method.



public void playerUpdate(Player pl, String event, Object eventData) {
try{
i if(event.equals(PlayerListener.STOPPED)) {
// close the player
_player.deallocate();
_player.close();
} else if(event.equals(PlayerListener.CLOSED)) {
//write your proedure
}
}
}catch(Exception ex){
System.out.println("Exception playerUpdate "+ex.toString());
}
}



This works good.

Now each time it gives screen shot... containing video....
__________________
Crazy for BlackBerry
Offline  




Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.