BlackBerry Forums Support Community

BlackBerry Forums Support Community (http://www.blackberryforums.com/index.php)
-   Developer Forum (http://www.blackberryforums.com/forumdisplay.php?f=15)
-   -   (JAVA) add menu items to menu : items are lost if blackberry simulator is restarted (http://www.blackberryforums.com/showthread.php?t=152055)

Mikaël Donini 09-26-2008 04:38 AM

(JAVA) add menu items to menu : items are lost if blackberry simulator is restarted
 
Hi All,

I have written a JAVA application that adds menu items to the calendar menu.

In the BlackBerry 8120 simulator, when I run this application, my menus items are correctly added in the calendar menu.

But if I stop the simulator (File\Exit) then restart it, the added calendar items have disappeared. I must run again the application (which is still present in the simulator) to add the menu items again.

Do you know what is wrong? How can I do to make these menu items persistent between 2 BlackBerries simulators restarts? Is it a normal simulator behaviour?


Here is my code:

Code:

import net.rim.blackberry.api.menuitem.ApplicationMenuItemRepository;
import net.rim.device.api.system.Application;

public final class TheApp extends Application {
        public static void main(String[] args)
        {
                new TheApp().enterEventDispatcher();
                System.exit(0);
        }

        public TheApp()
        {
                super();
               
                ApplicationMenuItemRepository repository = ApplicationMenuItemRepository.getInstance();
               
                // OpenConfMenuItem and EditConfParamsMenuItem are the classes that inherits ApplicationMenuItem
                OpenConfMenuItem ami1 = new OpenConfMenuItem();
                EditConfParamsMenuItem ami2 = new EditConfParamsMenuItem();
               
                repository.addMenuItem(ApplicationMenuItemRepository.MENUITEM_CALENDAR,        ami1);
                repository.addMenuItem(ApplicationMenuItemRepository.MENUITEM_CALENDAR,        ami2);
        }
}

Mikaël Donini, Arkadin France

Ivanov 09-26-2008 08:51 AM

you have to make your application starting during the startup of the device.

right-click on project, Application, check auto-run on startup


All times are GMT -5. The time now is 08:36 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.