不要让显示在JavaME中处于待机状态 [英] Don't let the display go to stand-by in JavaME

查看:86
本文介绍了不要让显示在JavaME中处于待机状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将视频流式传输到我的MIDLET.并且在播放时,手机上的20秒钟(取决于系统设置)显示将进入待机模式.

Im streaming video to my MIDLET. And while it is playing it, after 20 seconds (depends on a system setting) display on the phone goes to stand-by mode.

如何防止这种情况发生,例如,我可以观看5分钟的视频而不必点击某些东西来唤醒显示器?

How can I prevent this so I can watch the video for 5 minutes for example without having to tap something to wakeup the display?

推荐答案

是的,我知道了!!!但这有点小技巧,而不是实际的"Dont-Go-To-Stand-By"功能……尽管如此,它仍然可以完美 !!! = D

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

好的,所以我们的想法是定义需要唤醒显示器的超时时间.我让用户在设置"屏幕中定义它,并用RMS编写,以便以后阅读...

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...

接下来,我定义每次定义的超时时间到期时调用getDisplay().flashBacklight(100);方法的TimerTask.而且,这就像一个魅力!!! = D

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

这是概念代码.首先在VideoCanvas(用于绘制视频的屏幕)上,定义TimerTask:

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);
   }
}

接下来在VideoCanvas构造函数中,我启动计时器并将超时时间传递给它,例如10秒……就这样:

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);

***

因此,如果显示器在15秒后进入待机状态,并且计时器每隔10秒运行一次,它将永远不会进入待机状态,并且将一直唤醒直到您停止计时器为止.而且,如果它在5秒钟内处于待机状态,则计时器会在每次运行时将其唤醒,就像您在手机上点击某些东西将其唤醒一样. =)))

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 ... =)))

Yaaaay... =)))

P.S.在诺基亚N96上进行了测试.

这篇关于不要让显示在JavaME中处于待机状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆