Don't let the display go to stand-by in JavaME

无人久伴 提交于 2019-12-06 13:27:41

Yeeeey I figured it out!!! But its a little hack and not the actual "Dont-Go-To-Stand-By" functionality... nevertheless it works PERFECT!!!! =D

Ok so the idea is to define the timeout that the display needs to be woken up. I let the user define this in the "Settings" screen and I write that in RMS so I can read it later...

Next, I define the TimerTask that calls getDisplay().flashBacklight(100); method every time that the defined timeout expires. And, this works like a charm!!! =D

Here is the concept code. First on the VideoCanvas (screen for drawing video) I define the TimerTask:

private class WakeTask extends TimerTask
{
   public void run()
   {
      display.flashBacklight(100);
   }
}

Next in the VideoCanvas constructor I start the timer and pass it the timeout, for example 10 seconds... and thats it:

***

timer = new Timer();
timer.schedule(new WakeTask(), 0, 10000);

***

So if the display goes to stand by after 15 seconds, and the timer runs every 10 seconds, it will never go to stand by, and will stay waken until you stop the timer. And if it goes to stand by in 5 seconds, timer will wake it up every time it runs just like you do when you tap something on the phone to wake it up. =)))

Yaaaay... =)))

P.S. Tested on NOKIA N96.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!