I have a simple blackberry app that changes the LED settings (color, blinking, pattern). My current testing environment consists of a live Blackberry Bold (9000), and I have been running into an problem which I am not sure how to proceed.
Assume that my current Blackberry setup (LED wise) is to not flash unless there is a missed call, new message (of all varieties). The program I wrote will change the LED, which is fine, but the problem lies in closing the program. Closing the program causes a save/discard/cancel dialog to appear. For now, that isn't a problem since I'm only testing the application, the current problem is that even if you Discard the changes made, the light will continue flashing. I demoed the program to a friend and it kept flashing, I also noticed that when I received a new message and the light changes to red and kept flashing (instead of being Green, the last color i showed in the demo).
How do I reset the LED to it's previous state when exiting the program? Should or can I copy the existing settings (like flashing or not flashing when network is available) then on exit reset to saved defaults? Or is there a better way of resetting LED?
Code is pretty simple; view:
public HomeScreen(boolean error) {
redLED = new CustomButtonField("RED", Color.RED, Color.BLACK, Color.BLACK,
Color.WHITE, Field.FOCUSABLE);
add(redLED);
blueLED = new CustomButtonField("BLUE", Color.RED, Color.BLACK, Color.BLACK,
Color.WHITE, Field.FOCUSABLE);
add(blueLED);
whiteLED = new CustomButtonField("WHITE", Color.RED, Color.BLACK, Color.BLACK,
Color.WHITE, Field.FOCUSABLE);
add(whiteLED);
greenLED = new CustomButtonField("GREEN", Color.RED, Color.BLACK, Color.BLACK,
Color.WHITE, Field.FOCUSABLE);
add(greenLED);
redLED.setChangeListener(this);
blueLED.setChangeListener(this);
whiteLED.setChangeListener(this);
greenLED.setChangeListener(this);
}
public HomeScreen(long arg0)
{
super(arg0);
// TODO Auto-generated constructor stub
}
public void fieldChanged(Field field, int context)
{
LED.setState(LED.LED_TYPE_STATUS, LED.STATE_BLINKING);
if(field == redLED) {
LED.setColorConfiguration(500,5000,Color.RED);
}
if(field == blueLED) {
LED.setColorConfiguration(500,5000,Color.BLUE);
}
if(field == whiteLED) {
LED.setColorConfiguration(500,5000,Color.WHITE);
}
if(field == greenLED) {
LED.setColorConfiguration(500,5000,Color.GREEN);
}
}