简体   繁体   English

我想在使用J2ME的手机中没有任何GUI的情况下在手机的后台运行该应用程序吗?

[英]I want to run the application in background of mobile without any GUI in mobile using J2ME?

我正在开发一个网络应用程序,在该应用程序中我想在后台运行我的J2ME MIDP应用程序而没有任何GUI,因此以这种方式构造该应用程序的任何方法都可以。

try this 尝试这个

set your current Display to null. 将您当前的显示设置为空。 so there will not be any form or alert running on the screen. 因此屏幕上不会运行任何表格或警报。 But however your code will be running in the background. 但是,您的代码将在后台运行。

Display display = Display.getDisplay(this);  // here 'this' points to Midlet

display.setCurrent(null);

Yes this code works Good, 是的,此代码有效,

display = Display.getDisplay(this);
public void startApp()
{
    display.setCurrent(form);
}
public void pauseApp()
{

}
public void hide()
{
    Display.getDisplay (this).setCurrent (null);
}

This is will work like, make a button can after clicking it call hide Function, or you call this hide function in constructor so it will hide itself when app start, can you keep unHide statement in appStart() so if you Tab the program then it will unHide app again. 这将像这样,使按钮可以单击它,然后单击hide Function,或者在构造函数中调用此hide函数,以便在应用程序启动时将其自身隐藏,可以将unHide语句保留在appStart()因此如果按Tab程序,则它将再次取消隐藏应用。

NOTE: you said you are working on Network app, but some mobile will turn off the Internet Connection, when the Mobile screen Turn Off. 注意:您说您正在使用“网络”应用程序,但是当“移动设备”屏幕关闭时,某些移动设备将关闭Internet连接。 please check this. 请检查一下。 and If you found any solution It will be Good to share here. 并且,如果您找到任何解决方案,那么在这里分享将是一件好事。

it easy just have a code of line on any event for example in the click of button 很容易在任何事件上都有行代码,例如单击按钮

Display.getDisplay (this).setCurrent (null);

and return back the control via 并通过返回控制

Display.getDisplay (this).setCurrent (mycanvas);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM