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 Member
Posts: 1
Registered: ‎08-12-2011
My Device: N/A
My Carrier: N/A

FlashControl.FORCE Not Applying?

After tirelessly digging through the forums, I've decided to seek some advice from someone who is a bit more experienced with BlackBerry development than myself.  In trying to create a simple flashlight application, I've come up with the following code:

 

try 
{
	Player player = Manager.createPlayer("capture://video");
	player.realize();

	// Get the video control and set it to the current display.
	VideoControl videoControl = (VideoControl) player.getControl("VideoControl");

	Field videoField = null;
	if (videoControl != null) 
	{
		// Create the video field as a GUI primitive.
		videoField = (Field) videoControl.initDisplayMode(GUIControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");
		videoControl.setDisplaySize(330, 420);
		videoControl.setDisplayLocation(getContentWidth(), getContentHeight());
		videoControl.setVisible(true);
	}
			
	// Set the player to the STARTED state.
	player.start();

	FlashControl flashControl = (FlashControl) player.getControl("javax.microedition.amms.control.camera.FlashControl");
	
	try 
	{
		if (k == 1) 
		{
			flashControl.setMode(FlashControl.FORCE);
		} 
		else if (k == 0) 
		{
			flashControl.setMode(FlashControl.OFF);
		}
	}
	catch (Exception e) 
	{
		System.out.println("**********Error: " + e + "**********");
	}

	add(videoField);		
} 
catch (Exception e) 
{
	System.out.println("**********Error: " + e + "**********");
}

 

I've checked the FlashControl mode, and it has been set correctly.  I've also checked to make sure the device supports FlashControl.FORCE, and it does.  Really, I am quite stumped.  The code will correctly draw the video screen, but no matter what flash parameter i supply, I still get no results. 

 

Any input would be appreciated immensely, or even just a push in the right direction.  Thanks in advance!