BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 01-06-2010, 06: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 08:10 AM. Reason: pasted code snippet
Offline  
Old 01-11-2010, 09: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  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Keithley RF 1X72 System 41 RF Microwave Signal Routing Mainframe Switch DC-18GHz
$5500.0
Keithley RF 1X72 System 41 RF Microwave Signal Routing Mainframe Switch DC-18GHz pictureTektronix TDS CSA 8000 Communications Signal Analyzer Mainframe CORP MOD 89907
$599.95
Tektronix TDS CSA 8000 Communications Signal Analyzer Mainframe CORP MOD 89907 pictureTEKTRONIX TM 506 6 SLOT POWER MODULE MAINFRAME CHASSIS (A)
$49.99
TEKTRONIX TM 506 6 SLOT POWER MODULE MAINFRAME CHASSIS (A) pictureAgilent Keysight M9021A PCIe Cable Interface Module for M9018A PXIe Mainframe
$150.0
Agilent Keysight M9021A PCIe Cable Interface Module for M9018A PXIe Mainframe pictureHP / Agilent 54120A Digitizing Oscilloscope Mainframe - 20GHz
$249.95
HP / Agilent 54120A Digitizing Oscilloscope Mainframe - 20GHz picture






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