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 3-in-1 Lightweight Corded Stick Vacuum 2030 picture

Bissell 3-in-1 Lightweight Corded Stick Vacuum 2030

$28.88



BISSELL 3-in-1 Turbo Lightweight Stick Vacuum, 2610 (Black) picture

BISSELL 3-in-1 Turbo Lightweight Stick Vacuum, 2610 (Black)

$37.96



Vacuum Air Fuel Water Line Tube Hose Barbed Connector Coupling Tee Elbow T X Y picture

Vacuum Air Fuel Water Line Tube Hose Barbed Connector Coupling Tee Elbow T X Y

$1.99



Shark RV761_N Robotic Vacuum Cleaner With Charging Dock Navy Blue Black Tested picture

Shark RV761_N Robotic Vacuum Cleaner With Charging Dock Navy Blue Black Tested

$38.00



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

3 CFM Air Vacuum Pump HVAC Manifold Gauge Set AC A/C Refrigeration Kit

$47.35



250 L/min Vacuum Pump Cow Milking Machine For Cow Goat Milker Bucket Tank Barrel picture

250 L/min Vacuum Pump Cow Milking Machine For Cow Goat Milker Bucket Tank Barrel

$120.00







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