2011-12-15 24 views
0

我正在開發一個包含替代入口點的應用程序。 ,我在「不要在黑莓主屏幕上顯示」中打上勾號。這裏工作正常,它不會在主屏幕上顯示圖標。但我的問題是,如何從Blackberry的SwitchApplication彈出屏幕中禁用(隱藏)應用程序圖標?

當我從菜單(主屏幕)點擊SwitchApplication時,替代入口點圖標顯示在彈出式屏幕上,如下圖所示。我不想顯示icon.i想要以編程方式隱藏該圖標。

請幫我enter image description here

回答

1

只是重寫此方法,爲我們的應用程序 像下面

private static boolean flag=false; 
public static void main(String[] args) 
    { 
     StartUp startUp; 
     if(args!=null && args.length>0 && args[0].equals("gui")){ 
      flag=false; 
      startUp = new StartUp("gui"); 
      startUp.enterEventDispatcher(); 

     }else{ 
      flag=true; 
      startUp = new StartUp(); 
      startUp.enterEventDispatcher(); 
     } 
    } 

我重寫此方法

protected boolean acceptsForeground() { 

     return flag; 
    } 
1

可以隱藏應用程序,如果它的服務。爲bb ant工具設置系統模塊(systemmodule)爲true。 JDE和Eclipse插件也有類似的選項。

0

這是我結束了使用爲我工作的代碼。我曾嘗試在我的主Launcher類中放置了acceptForeground,但是之後將它放在PushListener本身中,以防止它出現在正在運行的任務菜單中。工作很好。

啓動類

public static void main(String[] args) { 
    if (args != null && args.length > 0 && args[0].equals("gui")) { 
     MyApp app = new MyApp(); 
     app.enterEventDispatcher(); 
    } else { 
     PushListener.waitForInstance().start(); 
    } 
} 

PushListener類

protected boolean acceptsForeground() { 
    return false; // You could use a variable instead if you wanted. 
} 
0

如果你使用黑莓Eclipse插件,這是很簡單的。

打開「blackberry_description_app.xml」,只需選中此項:不要在黑莓主屏幕上顯示應用程序圖標。

相關問題