Hi,
Because the vibrator can't be controlled on the 6600, I started to create a visual effect with the backlight.
Here is the code that makes this effect :
import javax.microedition.lcdui.*;
import com.nokia.mid.ui.*;
public class Flash
implements Runnable
{
private Display display;
public Flash(Display display)
{
this.display = display;
}
public synchronized void run()
{
int count = 0;
try
{
do
{
display.flashBacklight(250);
wait(250);
display.flashBacklight(0);
wait(250);
}
while (count++ < 4);
DeviceControl.setLights(0, 100); //does nothing
}
catch (InterruptedException ie)
{
}
}
}
Is there a best way to do that kind of effect ?
And most importantly when the loop ends, the backlight of the phone is turned off.
Is it possible to turn it on ? I tried and use the DeviceControl class without success.
Nokia 6600 firmware: v3.42.1 16-10-03 NHL-10
Here is the MIDlet that I use to test the effect
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class FlashMIDlet
extends MIDlet
implements CommandListener
{
private Form form = new Form("Flash");
private Command exit = new Command("Exit", Command.EXIT, 1);
private Command flash = new Command("Flash", Command.SCREEN, 1);
public void startApp()
{
form.addCommand(exit);
form.addCommand(flash);
form.setCommandListener(this);
Display.getDisplay(this).setCurrent(form);
}
public void pauseApp()
{
}
public void destroyApp(boolean param)
{
}
public void commandAction(Command command, Displayable displayable)
{
if (command == exit)
{
destroyApp(true);
notifyDestroyed();
}
else if (command == flash)
{
new Thread(new Flash(Display.getDisplay(this))).start();
}
}
}

Reply With Quote

