尝试记录args和args
[0](如果不为null)的值,以查看实际传递给main()的内容。您的编译过程可能存在问题,其中后台模块未传递参数(或未传递正确的值)。
另外,请尝试将EntryPointForApplication实例保存到静态变量中,以使其维护引用(不进行垃圾收集),并且如果在运行状态下再次从主屏幕上单击该图标,则不会启动多个实例您的应用程序。例如:
class EntryPointForApplication extends UiApplication { private static EntryPointForApplication theApp; public EntryPointForApplication() { GUIApplication scr = new GUIApplication(); pushScreen(scr); } public static void main(String[] args) { if ( args != null && args.length > 0 && args[0].equals("background1") ){ // Keep this instance around for rendering // Notification dialogs. BackgroundApplication backApp=new BackgroundApplication(); backApp.setupBackgroundApplication(); backApp.enterEventDispatcher(); } else { if (theApp == null) { // Start a new app instance for GUI operations. theApp = new EntryPointForApplication(); theApp.enterEventDispatcher(); } } } }


