BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 01-07-2010, 01:38 AM   #1
imran2k1
Knows Where the Search Button Is
 
Join Date: Jan 2010
Model: 8900
PIN: N/A
Carrier: telus
Posts: 35
Post Enabling Flash light for some time on Blackberry.

Please Login to Remove!

Hi every one!
i am making a small application to on the camera Flash light for desire time.
but it is not working on my BB 8900.
i am new to develop so, please help me.
if any error and wrong way is in my code?

public class Screen_1 extends MainScreen{

HorizontalFieldManager Hrm;
Player p;
FlashControl flashControl;
CameraControl cameracontrol;
SnapshotControl snapcontrol;

public Screen_1() {


super();
LabelField mylabel=new LabelField("MY TOURCH",Field.USE_ALL_WIDTH);
setTitle(mylabel);
add(new RichTextField("Do you want, Flash light ON?"));





/* initializing the player */
try{
p= Manager.createPlayer("capture://video");
(Manager.MIDI_DEVICE_LOCATOR);
p.realize();
p.start();
}
catch(IOException me){Dialog.alert("IOException in NO:" + me);}
catch (MediaException me){Dialog.alert(" MediaException in NO: " + me);}


FieldChangeListener yesButton= new FieldChangeListener()
{
public void fieldChanged(Field field, int context)
{

flashControl= (FlashControl)p.getControl("javax.microedition.amm s.control.camera.FlashControl");


if(flashControl!=null)
{
try{
int test_mode =flashControl.getMode();
int test_support_mode[] = flashControl.getSupportedModes();
flashControl.setMode(FlashControl.FORCE);
int now_test_mode= flashControl.getMode();
Dialog.alert("yes button");
}
catch (IllegalArgumentException e){Dialog.alert("Illeglexception in yes:" + e);}
}

snapcontrol = (SnapshotControl)
p.getControl("javax.microedition.amms.control.came ra.SnapshotControl");


//for(;;)
snapcontrol.start(1);





}
};


ButtonField yesButtonField = new ButtonField("Yes");
ButtonField noButtonField = new ButtonField("No");
yesButtonField.setChangeListener(yesButton);
noButtonField.setChangeListener(noButton);
//add(yesButtonField);
//add(noButtonField);
add(new SeparatorField());
Hrm= new HorizontalFieldManager();
Hrm.add(yesButtonField);
Hrm.add(noButtonField);
add(Hrm);


}


}


while to debug, i have take 3 interger to test, in test_mode i have been getting 1 (off) always and in now_test_mode i have been getting 4(ON) what ever i have been putting in setMode(4);
but when i have been saving it and looking in camera then it is not enabling flash light ON.
and when i am running the code on device it do not ON Flash light!

so, kingly help me and tell me what is bugg.. here!
thanks and Regards
Imran ali

Last edited by imran2k1; 01-07-2010 at 01:40 AM.. Reason: spell error
Offline  
Old 01-08-2010, 02:03 AM   #2
imran2k1
Knows Where the Search Button Is
 
Join Date: Jan 2010
Model: 8900
PIN: N/A
Carrier: telus
Posts: 35
Default

hi
i am getting every thing is fine as i think,
but when it is executing the line
snapcontrol = (SnapshotControl)
p.getControl("javax.microedition.amms.control.came ra.SnapshotControl");
snapcontrol.start(1); // giving exception here??
i also tried with this
snapcontrol.start(Integer.MAX_VALUE);
but still exception.
can any one health how to over come this.
because i think when snapcontrol will start flash will give light.
Thanks and regards
Offline  
Closed Thread



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


BISSELL CleanView Compact Upright Vacuum, Wand, 3508, Red,black picture

BISSELL CleanView Compact Upright Vacuum, Wand, 3508, Red,black

$52.80



VEVOR 9

VEVOR 9" Drywall Sander 850W Vacuum System Folding 6 Speed LED Strip Light

$99.43



Appion MGAVCT 1/4 Inches MegaFlow Vacuum-Rated Valve Core Removal Tool picture

Appion MGAVCT 1/4 Inches MegaFlow Vacuum-Rated Valve Core Removal Tool

$68.50



3 CFM 1/4HP Air Vacuum Pump HVAC Manifold Gauge Set AC A/C Refrigeration Kit US picture

3 CFM 1/4HP Air Vacuum Pump HVAC Manifold Gauge Set AC A/C Refrigeration Kit US

$58.99



Dental Vacuum Former Lab Forming Molding Machine Thermoforming Equipment 110V picture

Dental Vacuum Former Lab Forming Molding Machine Thermoforming Equipment 110V

$97.00



Kiwi Complete Vacuum Delivery System OmniCup VAC-6000MT - Fast Shipping picture

Kiwi Complete Vacuum Delivery System OmniCup VAC-6000MT - Fast Shipping

$106.25







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