返回信息流rt,j2me里面有没有什么方法可以判断程序的运行状态,是在前台还是后台运行呢?
各位达人帮帮忙啦~~
这是一条镜像帖。来源:北邮人论坛 / java / #14070同步于 2010/4/18
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Java机器人发帖
请教,j2me里有没有什么方法判断程序是否处于前台啊?
dillan
2010/4/18镜像同步7 回复
订阅后,新回复会通过你的通知中心匿名送达。
7 条回复
在屏幕最上方就是我想说的前台。当前显示的程序。 有没有什么方法啊、
另外j2me里面好像没有isDaemon()这个方法吧。我再去查查。
【 在 ericyosho 的大作中提到: 】
: 你说的前台后台是什么意思?
: 是指在屏幕上最上方的就是前台?
: 还是说daemon程序就是后台?
: ...................
对对对,是这个意思。
用线程sleep一段时间,然后显示一个页面。
如果在sleep过程中用户操作使界面显示其他程序时,线程sleep结束后又自动显示了安排好的页面,这不是我想要的啊,该怎么解决呢?
请教各位啊!
【 在 lazytiger 的大作中提到: 】
: 嗯,这个问题是比较有意思,楼主的意思应该是程序被挂起,不在界面上显示时,如果有事件发生,不要将其反映出来。这个可能是j2me的内部机制。
: 帮顶!
: --
: ...................
public Displayable getCurrent()
Gets the current Displayable object for this MIDlet. The Displayable object returned may not actually be visible on the display if the MIDlet is running in the background, or if the Displayable is obscured by a system screen. The Displayable.isShown() method may be called to determine whether the Displayable is actually visible on the display.
The value returned by getCurrent() may be null. This occurs after the application has been initialized but before the first call to setCurrent().
Returns:
the MIDlet's current Displayable object
See Also:
setCurrent(javax.microedition.lcdui.Displayable)
这样子就可以判断了
确实可以! 谢谢啦~~
【 在 lazytiger 的大作中提到: 】
: public Displayable getCurrent()
: Gets the current Displayable object for this MIDlet. The Displayable object returned may not actually be visible on the display if the MIDlet is running in the background, or if the Displayable is obscured by a system screen. The Displayable.isShown() method may be called to determine whether the Displayable is actually visible on the display.
: The value returned by getCurrent() may be null. This occurs after the application has been initialized but before the first call to setCurrent().
: ...................