ToolBarMenuButton.AddMenuItem ApplicationMenuItemRepository

Hello everyone.

It's my problem.

I use the ApplicationMenuItemRepository.addMenuItem method to add a menu item in the file Explorer. I want to launch my app

only for certain types of files, only images.

I found useful the fourth argument of the addMenuItem () method.

void addMenuItem (long id, point ApplicationMenuItem, ApplicationDescriptor application, object context)

I have this code for JPG images and it is ok.

ToolBarMenuButton.AddMenuItem (ApplicationMenuItemRepository.MENUITEM_FILE_EXPLORER_BROWSE, Qualityvelocity, DPA, should new String ("image/jpg"));

But, my question is, how to specify types of different images in this context object? GIF, jpg, png

Thanks in advance and sorry for my bad English. :/

Platform:
Eclipse + 4.5 JDE component package
Simulator v4.6, BB bold 9000

It's true.

Seems to be unnecessary code, but finally is the only way it works.

ApplicationMenuItem imageMenuGIF = new PEdMenuItem();
ApplicationMenuItem imageMenuJPEG = new PEdMenuItem();
ApplicationMenuItem imageMenuPNG = new PEdMenuItem();
   
amir.addMenuItem (ApplicationMenuItemRepository.MENUITEM_FILE_EXPLORER_BROWSE, imageMenuGIF, CCA, "image/png");
amir.addMenuItem (ApplicationMenuItemRepository.MENUITEM_FILE_EXPLORER_BROWSE, imageMenuJPEG, CCA, "image/jpg" "");
amir.addMenuItem (ApplicationMenuItemRepository.MENUITEM_FILE_EXPLORER_BROWSE, imageMenuPNG, CCA, "image/gif");

Thank you!

Tags: BlackBerry Developers

Similar Questions

  • ToolBarMenuButton.AddMenuItem (ApplicationMenuItem) survey java.lang.Error

    ApplicationMenuItemRepository.getInstance () .addMenuItem (ApplicationMenuItemRepository.MENUITEM_SYSTEM, applicationmenuitem)

    It shows an error: "Eception exception: Java.lang.Error.

    The exception cannot be caught and does not appear in the debugger, only on the phone.  It happens once ToolBarMenuButton.AddMenuItem calls toString in the ApplicationMenuItem, but the chain is fine - a literal.

    The call stack is several levels deep within unknown methods.

    Works fine in simulators and on the storm, but not on a 8330 4.5 running.

    Solved.  For some reason you need PIM / permission to organizers to add the entire system menu items.  I got the module defined with this permission, but the CodeModuleGroup didn't.

    They did of course difficult to debug it - he didn't throw a ControlledAccessException as it was supposed to.  Instead, he threw something that cannot yet be intercepted, which means that if users don't have the right permissions, the bombs of the app with an error that could be anything.

    Checks permissions and prompting if necessary, but in the past have always had requests for assistance relating to permissions yet, so it does not always work.

  • How can I catch exception on addMenuItem() in ApplicationMenuItemRepository?

    Hi All-

    I test my code with application permissions set to "Refuse" to make my app to work properly in this case and inform the user what to do. I've successfully managed a few other cases (for example cannot access the RuntimeStore) with an exception handler.

    However, when I try to call addMenuItem() as the code below, my statement something catches not the exception. In the debugger, I get the message following 'eception thrown exception - Sub. And on the blackberry screen, I get "Eception exception: java.lang.Error.

    Anyway to catch this exception so I can tell the user what to do?

    Thank you!

    Nicholas

    ApplicationMenuItemRepository amir = ApplicationMenuItemRepository.getInstance();
    
    try {
        amir.addMenuItem(ApplicationMenuItemRepository.MENUITEM_SYSTEM, ami);
    
    } catch (Exception e) {
        String s = e.toString();  // never gets here :(
    
    }
    

    Try to catch Throwable instead of Exception.  Error and Exception are according to Throwable.  Which should catch both.

  • ApplicationMenuItemRepository:removeMenuItem does not delete added proviously MenuItem

    Hello

    I use following code for in my MIDlet startup() adds a MenuITem to BlackBerry menu

                    //////////////////////////////////////////////////////////////////////               net.rim.blackberry.api.menuitem.ApplicationMenuItemRepository repository = net.rim.blackberry.api.menuitem.ApplicationMenuItemRepository.getInstance();
                    GlobalMenuItem smi = new GlobalMenuItem();
    
    //to remove previously added Item - But it always returns false
                    boolean b = repository.removeMenuItem(ApplicationMenuItemRepository.MENUITEM_SYSTEM, smi);               
    
                    repository.addMenuItem(ApplicationMenuItemRepository.MENUITEM_SYSTEM, smi);
                    //////////////////////////////////////////////////////////////////////
    

    But each time you launch the app I see keep seal the MenuITem in the BlackBerry HomeScreen menu. removeMenuItem doesn't seem to work? Whats wron?

    He would remove the menu correctly - item but the menu item is not yet added.

    to remove the previous menu item you would need a reference to it.

    I suggest using the runtimestore or an Autostart entry point.

  • MenuItem, duplication on ApplicationMenuItemRepository

    Hi guys!

    I'm creating an application is adds a MenuItem to the menu system.

    This means that it will be visible in all applicactions.

    Everything works fine, but there is a small problem.

    When you enter the application (via the application in the bb menu icon), a configuration screen will appear.

    Everything is fine, except that MenuItem creates and adds to the Menu system, once again... and if you close and open the configuration screen, it happens again... and so on...

    I tried to use the AddMenu as a thread as a background application, but it continues to be.

    Here is my sample code...

    any ideas?

    Main application class:

    public class MyApp extends UiApplication{
    
        private BackgroundClass bgThread;
    
        public static void main(String[] args){
            MyApptheApp = new MyApp();
            theApp.enterEventDispatcher();
        }
    
        public MyApp()
        {
            bgThread = new BackgroundClass();
            bgThread.start();
            pushScreen(new ConfigScreen());
        }
    
        protected void onExit()
        {
            bgThread.stop();
        }
    }
    

    Thread class:

    public class BackgroundClass extends Thread {
        MenuItem myMenuItem = new MenuItem(0);
    
        public void run()
        {
            ApplicationMenuItemRepository.getInstance().addMenuItem(ApplicationMenuItemRepository.MENUITEM_SYSTEM,myMenuItem);
        }
    
        public synchronized void stop()
        {
            ApplicationMenuItemRepository.getInstance().removeMenuItem(ApplicationMenuItemRepository.MENUITEM_SYSTEM,myMenuItem);
        }
    
    }
    

    The ConfigScreen class has nothing about it, so it is useless to post...

    Any ideas?

    Thanks in advance!

    See you soon!

    RuntimeStore store = RuntimeStore.getRuntimeStore();
    String msg = "item1";
    long ID = 0x60ac754bc0867248L;                     
    
    Object obj = store.get(ID);
    if(obj == null)
    {
    
    MenuItemClass menuItem = new kMenuItemClass(0,this);                                        
    
    ApplicationMenuItemRepository repository =  ApplicationMenuItemRepository.getInstance(); 
    
    long id = ApplicationMenuItemRepository.MENUITEM_PHONE;
    repository.addMenuItem(id, menuItem);
    try
    {
     store.put( ID, msg );
    } catch(IllegalArgumentException e)
    {
    }
    
    }
    
  • Runtime exception: ApplicationRegistry.waitFor () timeout

    We have a device 8800 (firmware 4.1.2.79) with a runtime exception whenever on the battery reset. Morganphone is an in-house application built on JDE 4.1.0.  This device also shows the same exception of ApplicationMenuItemRepository.addMenuItem on another application inhouse.  I suspect it is device-specific, but what causes this runtime exception?

    Name: RuntimeException

    GUID: 9c3cd62e3320b498

    Time: August 6, 2008 09:33:48

    ApplicationRegistry.waitFor (0x1c83a547b3934c66) timeout

    net_rim_cldc-4

    ApplicationRegistry

    0x483D

    net_rim_cldc-4

    ApplicationRegistry

    waitFor

    0 x 4710

    net_rim_cldc-4

    ApplicationRegistry

    waitFor

    0x467B

    net_rim_bb_apps_framework-2

    TaskCollectionHolder

    getTaskCollection

    0x265C

    net_rim_pdap-1

    ToDoListImpl

    0x8E9

    net_rim_cldc-1

    Class

    newInstance

    0 x 2186

    net_rim_pdap

    ToDoListFactory

    createToDoList

    0xCDA5

    net_rim_pdap

    PIMImpl

    openPIMList

    0xA13D

    net_rim_bbapi_menuitem

    SdkProxyVerb

    0 x 897

    net_rim_bbapi_menuitem

    ApplicationMenuItemRepository

    ToolBarMenuButton.AddMenuItem

    0x27F

    net_rim_bbapi_menuitem

    ApplicationMenuItemRepository

    ToolBarMenuButton.AddMenuItem

    0xDC

    com_ms_morganphone

    MorganPhone

    main

    0 x 1265

    Thank you

    June Jorgensen

    Thanks for the explanation. Detective Conan.

    June

  • the menu item run method not called

    Eclipse SDK Version: 3.4.1

    BlackBerry JDE plugin for Eclipse Version: 1.0.0.50

    BlackBerry JDE component package Version: 4.5.0.14

    I added a menu item to the contacts list. I would like to get the context when the user clicks the menu item, but the run method is not entered. When the user clicks the item in the menu the main routine is entered with correct arguments. Should not called run with the context method? No exception is thrown.

     

    Import net.rim.blackberry.api.menuitem.ApplicationMenuItem;
    Import net.rim.blackberry.api.menuitem.ApplicationMenuItemRepository;
    Import net.rim.device.api.system.Application;
    Import net.rim.device.api.system.ApplicationDescriptor;

    SerializableAttribute public class BwMain extends Application {}
    private static final long APP_ID = 0xf46f5a7867d69ff0L;
    private static final String ARG_LAUNCH_BW = "1";

    public BwMain() {}
    long menuItemLocation = ApplicationMenuItemRepository.MENUITEM_ADDRESSBOOK_LIST;
    ContactsBwMenuItem menuItem = new ContactsBwMenuItem();
    ToolBarMenuButton.AddMenuItem (menuItemLocation, ARG_LAUNCH_BW, menuItem);
    System.Exit (0);
    }

    Public Shared Sub main (String [] args) {}
    If (args == null | args.length == 0) {}
    BwMain bwMain = new BwMain();
    bwMain.enterEventDispatcher ();
    }
    else {}
    System.out.println ("App launched from the menu");
    }
    }

    private public static Sub ToolBarMenuButton.AddMenuItem (long location, String argOfAppl, ApplicationMenuItem appMenuItem) {}
    Amir ApplicationMenuItemRepository = ApplicationMenuItemRepository.getInstance ();
    ApplicationDescriptor app = ApplicationDescriptor.currentApplicationDescriptor ();
    app = new ApplicationDescriptor (app, new String [] {ARG_LAUNCH_BW});
    amir.addMenuItem (location, appMenuItem, app);
    }

    private static class ContactsBwMenuItem extends ApplicationMenuItem {}
    {ContactsBwMenuItem()}
    Super (20);
    }

    public String toString() {}
    return "PC connection";
    }

    public Object execute (object context) {}
    try {}
    System.out.println ("input run method");
    } catch (Exception e) {}
    e.printStackTrace ();
    }
    Returns a null value.
    }
    }
    }

    You call system.exit() in the Builder before entering the EventDispatcher. I'm guessing that you add the menu item, but leave the application, and when the menu item is called it is more a reference to the context of the application and decides not to continue. The menu item will not remove itself when the application closes.

  • PopupScreen in an Application

    I have a system application that extends the Application and adds a MenuItem in the Contacts menu. Once you click on this istaniates a class which extends screen. This class checks to be sure, there is a correct e-mail address for this contact. Everything is good so far. Once it is determined that the email address is good, then he instaniates a class that extends the PopupScreen and the error occurs. I'm going in the right direction or should I do this differently. I'm relatively new to BB dev. Thank you

    Here is the code

    class ContactInfo extends UiApplication {}
    private static final String ARG_LAUNCH_CONTACT_INFO = "1";
    private static ContactInfo above;
           
    Public Shared Sub main (String [] args) {}
    If (args == null | args.length == 0) {}
    This = new ContactInfo("");
    ci.enterEventDispatcher ();
    } else {}
    String appToLaunch = args [0];
    If (ARG_LAUNCH_CONTACT_INFO.equals (appToLaunch)) {}
    try {}
    This = new ContactInfo (appToLaunch);
    ci.enterEventDispatcher ();
    } catch (IllegalStateException s) {}
    Status.Show (s.ToString ());
    }
    }
    }
    }
               
    public ContactInfo (String param) {}
    If (parm.equals("")) {}
    long locationToAddMenuItem = ApplicationMenuItemRepository.MENUITEM_ADDRESSBOOK_LIST;
    ToolBarMenuButton.AddMenuItem (ARG_LAUNCH_CONTACT_INFO, locationToAddMenuItem, ContactsMenuItem()) new;
    System.Exit (0);
    } else {}
    System.out.println ("start COntactsMenuItem");
    new ContactsMenuItem();
    }
    }

    private public static void ToolBarMenuButton.AddMenuItem (String argOfAppl, long location, ApplicationMenuItem applMenuItem) {}
    Amir ApplicationMenuItemRepository = ApplicationMenuItemRepository.getInstance ();
    ApplicationDescriptor app = ApplicationDescriptor.currentApplicationDescriptor ();
    App = new ApplicationDescriptor (app, new String [] {argOfAppl});
    amir.addMenuItem (location, applMenuItem, app);
    }
       
       
    private static class ContactsMenuItem extends ApplicationMenuItem {}
    public ContactsMenuItem() {}
    Super (200000);
    }
           
    public String toString() {}
    return 'Contact Info';
    }
           
    public Object execute (object context) {}
    BlackBerryContact c = (BlackBerryContact) context;
    If (c! = null) {}
    Application.getApplication () .requestForeground ();
    try {}
    System.out.println ("Got a contact");
    Ui.getUiEngine () .pushScreen (new MChoices (c));
    / * While (! Barreter) {}
    try {}
    Thread.Sleep (250);
    } catch (InterruptedException e) {}
    Dialog.Alert ("Thread interrupted");
    }
    }*/
    } catch (IllegalStateException s) {}
    System.out.println ("illegal state error =" + s.getMessage ());
    Status.Show (s.ToString ());
    }
    } else
    throw new IllegalStateException ("Context is null, expects an instance of Contact");
    Returns a null value.
    }
    }
       
    static class final MChoices extends PopupScreen implements FieldChangeListener {KeyListener
    private BlackBerryContact c;
    ButtonField private close, update;
    Photo exhib CheckboxField, pine, Manager, phone;
    private String [] name = new String [3];
    private String fullName, email;
                          
    public MChoices (contact BlackBerryContact) {}
    Super (new FlowFieldManager(), Field.FOCUSABLE |) Field.FIELD_HCENTER);
    c = contact;
    name = c.getStringArray (BlackBerryContact.NAME, 0);
    fullName = name [BlackBerryContact.NAME_FAMILY] + ', ' +.
    name [BlackBerryContact.NAME_GIVEN];
    System.out.println (FullName);
               
    LabelField cont = new LabelField ("Contact:" + fullName, Field.FIELD_HCENTER |) Field.USE_ALL_WIDTH);
    Add (cont);
    White LabelField = new LabelField ("", Field.USE_ALL_WIDTH);
    Add (blank);
    Photo = new CheckboxField ("Photo", true, Field.FIELD_LEFT |) Field.USE_ALL_WIDTH);
    PIN = new CheckboxField ("spit", true, Field.FIELD_LEFT |) Field.USE_ALL_WIDTH);
    Director = new CheckboxField ("Manager", true, Field.FIELD_LEFT |) Field.USE_ALL_WIDTH);
    Phone = new CheckboxField ("Phone Info", true, Field.FIELD_LEFT |) Field.USE_ALL_WIDTH);
    Add (photo);
    Add (pin);
    Add (Manager);
    Add (Phone);
    LabelField blank2 = new LabelField ("", Field.USE_ALL_WIDTH);
    Add (blank2);
    Update = new ButtonField ("Update Contact", Field.FIELD_HCENTER);
    close is new ButtonField ("close", Field.FIELD_HCENTER);.
    Add (Update);
    Add (Close);
    photo.setChangeListener (this);
    pin.setChangeListener (this);
    manager.setChangeListener (this);
    phone.setChangeListener (this);
    update.setChangeListener (this);
    close.setChangeListener (this);
    update.setFocus ();
    }
                   
    ' Public Sub fieldChanged (field field, int context) {}
    If (field == relatives) {}
    This.Close ();
    } ElseIf (field == update) {}
    If (c.countValues (BlackBerryContact.EMAIL) > 0) {}
    updateContact();
    } else {}
    Dialog.Alert ('no email for Contact');
    This.Close ();
    }
    }
    }
           
    {public boolean keyStatus (keycode int, int times)
    Returns false;
    }
           
    {public boolean keyRepeat (keycode int, int times)
    Returns false;
    }
           
    {} public boolean keyUp (keycode int, int times)
    Returns false;
    }
           
    {} public boolean keyDown (keycode, int, int times)
    Returns false;
    }
           
    {} public boolean keyChar (key char, int status, int time)
    Boolean retval = false;
    switch (key) {}
    case Characters.ESCAPE:
    This.Close ();
    break;
    by default:
    retval = super.keyChar (key, status, time);
    }
    Return retval;
    }
           
    private void updateContact() {}
    email = c.getString (BlackBerryContact.EMAIL, 0);
    System.out.println (email);
    If (photo.getChecked ()) {}
    make the photo because it is checked
               
    }
    This.Close ();
    }
    }
    }

  • Getting context object null when using the custom menu item.

    Hi all

    I implemented a sample application to add menu item custom to the list of messages and we test this build on 9000 os 5.0.0.41 Blackberryy 1

    On BB 9000, we have 2 message inbox, A like Blackberry by default message inbox and B as long as the Inbox for the e-mail account, I have set up on BB 900.
    I implemented the menu custom application to add menu on the message list option.
    I see this option on both my inbox, the question that I am facing is when I click on the menu item by selecting the email in the message of default A Blackberry inbox I can get the context object were like when I click on the same message next to the Inbox B I'm always get the context as a NULL object.

    Below is the code I used to add the custom menu item.

    Public Shared Sub main (String [] args)
    {
    If (args! = null & args.length > 0) {}
    call from another entry point. Add menu items mark as Spam and mark as suspects.
    {if(args[0].) (Equals ("GUI"))}
    try {}
                            
    create menu items.

    MyMenu ApplicationMenuItem = new EmailFile();
    Add the menu item in the list view and send by e-mail.
    Amir ApplicationMenuItemRepository = ApplicationMenuItemRepository.getInstance ();
    amir.addMenuItem (ApplicationMenuItemRepository.MENUITEM_MESSAGE_LIST, mymenu);
    } catch (Exception e) {}
    Utility.debugLog (try (), CLASSNAME, 'hand', Utility.EXCEPTION_INFO);
    System.out.println("Error:"+e.ToString());)
    }
    } else {}
    show on the application of spam...
    AppMain _theApp = new AppMain();
    _theApp.enterEventDispatcher ();
    }
    } else {}
    show on the application of spam...
    AppMain _theApp = new AppMain();
    _theApp.enterEventDispatcher ();
    }
    }

    Can we know what is the problem in my code or something I'm missing.

    Thanks in advance.

    Navneet Gupta.

    application menu items have been bugged for ages. There is nothing you can do except change your workflow. in some cases, you can recover the app screen and trying to extract something of these fields, but becomes more difficult in the new OS versions because of custom fields used by rim.

  • JDE 4.2 + default ApplicationMenuItem

    Hello

    I join some menu items customized with the BB system menu. As follows:

    ApplicationMenuItemRepository.getInstance().addMenuItem(ApplicationMenuItemRepository.MENUITEM_EMAIL_EDIT ,this);
    

    It works well enough. My custom menu items appear in the menu.

    But anyone know anyway that I can get my custom menu items appear in the default short list of menu items that appears when the user presses the trackball?

    ApplicationMenuItems only appear in the menu, not the reduced.  Third-party applications are not able to add ApplicationMenuItems to the menu of built-in applications reduced.

  • How can I do to if a menu item exists, doesn´t repeat menuItem when I install another version of the app?

    Hello

    I m developing an application printing email and I want to put a menu item in the emails with the option 'print with... '. ». I use this:

    PrintByMenuItem myMenuitem = new PrintByMenuItem (0);

    ApplicationMenuItemRepository.getInstance (.addMenuItem (ApplicationMenuItemRepository.MENUITEM_EMAIL_VIEW),
    myMenuitem, ApplicationDescriptor.currentApplicationDescriptor ());
    ApplicationMenuItemRepository.getInstance (.addMenuItem (ApplicationMenuItemRepository.MENUITEM_EMAIL_EDIT),
    myMenuitem, ApplicationDescriptor.currentApplicationDescriptor ());
    ApplicationMenuItemRepository.getInstance (.addMenuItem)
    ApplicationMenuItemRepository.MENUITEM_MESSAGE_LIST, myMenuitem, ApplicationDescriptor.currentApplicationDescriptor ());

    My application has two versions, with ads or no ads. When the user to install the first version and then they want to install the second version, the application will overwrite and will be only one application in the device.

    The problem is that when I install the second version, the menu item 'print with... '. ' appears twice. How can I do to if a menu item exist in enamel, doesn´t repeat the menuItem?

    I ve tried using removeMenuItem before adding the menu item with:

    ApplicationMenuItemRepository.getInstance (.removeMenuItem)
    ApplicationMenuItemRepository.MENUITEM_EMAIL_VIEW, myMenuitem);
    ApplicationMenuItemRepository.getInstance (.removeMenuItem)
    ApplicationMenuItemRepository.MENUITEM_EMAIL_EDIT, myMenuitem);
    ApplicationMenuItemRepository.getInstance (.removeMenuItem)
    ApplicationMenuItemRepository.MENUITEM_MESSAGE_LIST, myMenuitem);

    But doesn´t works.

    Thank you.

    This is not how it would work production / the device. After restarting the device, the menu item will be deleted from the repository, and you will have a menu item.

    However, if you leave your app and try again (if you save the menu items at the application startup) the you'll thus duplication. If this isn't the case, then you should not worry.

    If this is the case, then I suggest your store a veriable TERM as a check to ensure no duplicates.

  • How to paste text in ANY editable field (e-mail, sms, browser, contacts address bar / any other application)

    Hello

    Can anyone help me please with the following questions:

    1. once I have add a menu item to help

    ApplicationMenuItemRepository.getInstance().addMenuItem(ApplicationMenuItemRepository.MENUITEM_SYSTEM, myMenuItem);
    

    I am able to access an instance of net.rim.blackberry.api.mail.Message (when I'm in the e-mail editing mode) and put the content in the subject / body of the email, but it was mostly a proof of concept for me.

    What I really want to be able to do, it's automatically access the instance of any editable field in any (RIM / part 3) app that the user cursor is now. When the focus is on something that is not editable, then my menu item should not appear in the menu.

    In addition, it is important for me to know exactly where the cursor is. For example if the cursor is in the middle of the text, then I want that my extraordinary paste paste of stuff there. The same for the selected text - it needs to be replaced.

    Basically I want my menu Paste Special feature works exactly like 'Stick', unless I want to offer which should be pasted.

    2. Apart from curiosity, what are we supposed to go back to the

    public Object run(Object context)
    

    method? For now, I'm doing my treatment based on the type of control context and make the treatment on it and everything just return null (which works well), but I don't know I'm on some features.

    Never done this, but looking at the API and remembering what simon_hain said when asked a similar question, I think it goes like:

    You can get help from the active screen

    UiApplication.getUiApplication () .getActiveScreen ();

    You can get the Menu for a screen to help

    . getMenu();

    You can browse the menu for help

    . getItem()

    for

    . getSize()

    entries.

    I think that 'toString' will give you the message, then

    . Run()

    to run it.

  • [BB 5.0] Impossible to return to the foreground

    I know similar problems have been discussed several times already, but looks like I'm still too noob to solve my problem. A problem is the following.

    I am trying to create a simple GUI application. It starts automatically, adds a special menu item in the system menu and goes to the background hidden from the list of applications. Once the user clicks on the item menu (mentioned above), the application must show the user, do something and go back to the background. I used this article as a guide.

    My code is (BTW, how I format the code here?):

    SerializableAttribute public class BackTest extends UiApplication {}

    private static final long APP_ID = 0xda989447901484c8L;

    Private boolean isHidden = true;

    Public Shared Sub main (String [] args) {}
    RuntimeStore store = RuntimeStore.getRuntimeStore ();

    BackTest PAP = null;

    If (args == null | args.length == 0) {}
    PAP = (BackTest) store.get (APP_ID);
    If (PAP! = null) {}
    theApp.setHidden (false);
    theApp.requestForeground ();
    }
    } else {}
    final BackTest app = PAP = new BackTest();
    Store.Replace (APP_ID, PAP);

    theApp.createMenuItem ();
    theApp.setHidden (true);
    theApp.invokeLater (new Runnable() {}
    public void run() {}
    app.moveToBackgroundOnStart ();
    }
    });
    theApp.enterEventDispatcher ();
    }
    }

    public BackTest() {}
    pushScreen (new BackTestScreen());
    }

    private void moveToBackgroundOnStart() {}
    ApplicationManager man = ApplicationManager.getApplicationManager ();
    KeepGoing Boolean = true;
    {while (keepGoing)}
    If (man.inStartup ()) {}
    try {}
    Thread.Sleep (500);
    } catch (Exception ex) {}
    } else {}
    this.requestBackground ();
    }
    }
    }

    protected boolean acceptsForeground() {}
    return! this.isHidden ();
    }

    protected boolean isHidden() {}
    Return isHidden;
    }

    protected void setHidden (boolean isHidden) {}
    this.isHidden = isHidden;
    }

    private void createMenuItem() {}
    placement of int = 0 x 350111;
    Element ApplicationMenuItem = new ApplicationMenuItem (investment) {}
    public String toString() {}
    return to 'Just Do It';
    }

    public Object execute (object context) {}
    try {}
    ApplicationManager.getApplicationManager (.launch ("BackTest"));
    } catch (ApplicationManagerException e) {}
    e.printStackTrace ();
    }
    Returns a null value.
    }
    };

    The ApplicationMenuItemRepository repo = ApplicationMenuItemRepository.getInstance ();
    repo.addMenuItem (ApplicationMenuItemRepository.MENUITEM_SYSTEM, item);
    }
    }

    My problem is that when I click on the menu item "Just Do It", the application does not appear. I see in the debugger, that requestForeground is called, but nothing happens after that. I tried different things, like using GlobalEventListener instead of launching the app again (which resembles the app in the background does not receive events) or by calling requestForeground directly in the menu item Manager, but nothing happens.

    What I am doing wrong?

    PS the JRE BB version is 5.0.

    Interestingly, the code seems fine for me.  Sorry don't have time to test it myself ATM - maybe later.

    There is one thing I would change:

    theApp.invokeLater (new Runnable() {}
    public void run() {}
    app.moveToBackgroundOnStart ();
    }
    });

    This in theory, runs your "pen" treatment, specifically sleep, on the thread of events.  You need not actually the bottom of the request to wait because if your application is enough to throw things on the event thread, then it can deal with the merits of the request.  Then you can just run the requestBackground

    If you have other things you plan to wait at first, then in the executable you invokeLater, start a new Thread.  Sounds a bit complicated, I know.

    I don't think that this causes you a problem in this circumstance.

    I would like that you try to move your code to the main() in the run method ApplicationMenu.  There is no problem with this code getting your instance of the application and then by running requestForeground() on it.

    If this does not help, you can do two things:

    (1) create activate(), deactivate() methods in your Application, simply d put something out of System.out when these are run - call super too of course!  See the Application section to determine what these do.

    (2) put a breakpoint in acceptsForeground() and see when it is in the order of things, it is called.  I have an idea it is actually called earlier than you expect.

  • Get multiple recipients of menu item TEXT context

    I added my menu item custom to the SMS composer with the following code.

    ApplicationDescriptor app = ApplicationDescriptor.currentApplicationDescriptor();
    ApplicationMenuItemRepository repository = ApplicationMenuItemRepository.getInstance();
    repository.addMenuItem(ApplicationMenuItemRepository.MENUITEM_SMS_EDIT, mySmsMenu, app);
    

    Then I implement the run method of the ApplicationMenuItem as follows:

    public Object run(Object context) {
            TextMessage c = (TextMessage)context;
            if (c != null) {
                String sendTo = c.getAddress();
                String msgBody = c.getPayloadText();
    
             }
    }
    

    I get the message and a single number of recipient successfully. But how do I manage for multiple recipients? He even supported?

    Thank you

    This is not currently supported.  I will pass on this feedback to our product management team.

  • Full Menu vs. Click Menu

    This should be an easy, I hope

    I use ToolBarMenuButton.AddMenuItem (oddly) add the menu items to my screen that extends from screen. Works fine, but the items appear in both menus - the full Menu and the Menu that appears when you click the trackball.

    Can I override the behavior if I put things into the trackball click on the menu that do not appear in the full menu? I want to serve the choices that are specific to entire screen I'm on the menu as more of a selection of articles that apply to the application and click on the menu.

    Thank you

    Found my answer here:

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800608/...

Maybe you are looking for

  • HP Compaq 8710w and drivers Windows 8.1 for Quadro FX 3600 M

    Hi everyone I have a HP Compaq 8710w and it works very well so far. There is a problem experienced with Quadro FX 3600 M drivers in Windows 7 If you do not use the old drivers given the HP (186,24) but other than that, everything is ok. https://forum

  • Satellite L300 - power fail

    I have two Satellite L300 (2 different models), but I had several failures of the supplies provided. The first computer laptop power supply has failed in the first week, the replacement, the supplier sent me (Ebuyer) did not work at all. After severa

  • Aspire M1600 audio problems

  • How to hide an icon on my desktop

    How to hide an icon on my desktop. I want to hide an icon for example desktop.ini from my office. I need help.

  • Try to get 32-bit Vista to see over 2.5 GB of my ram 4 GB - T500

    Hi all I read what I can find on the subject and we tried the following suggestions (http://www.ocmodshop.com/ocmodshop.aspx?a=989) to back up towards the top of the amount of physical ram that Vista sees. I tried to pae forceenable, then: Type BCDed