ApplicationMenuItem called with null in JDE 4.6 when you enter the phone number

When I install a custom phone app, ApplicationMenuItem and

try to enter a number on the keypad of the native Dialer, and then click the custom menu,

my custom ApplicationMenuItem is called with a null context object.

This same code + test case works well under the 4.5 JDE / 8300 emulator

and device 8320, but fails under JDE 4.6 with the BB 9000 emulator

and device

To reproduce the bug:

* Build/launch of the attached test application

* Send with previous key

* Go to the native Dialer

* Enter "123" on the keyboard of the phone

* Click on the trackball

* Choose Bug49 the context menu

* It will appear a dialog box indicating "context has the null value - is this a bug?

NOTE that if, rather than enter a number on the keypad of the phone with step 4.

a call log is selected, then it works and a non-null context object is passed.

Can I make it work?  If this is a known bug, are

It no work around?

import net.rim.blackberry.api.menuitem.ApplicationMenuItem;import net.rim.blackberry.api.menuitem.ApplicationMenuItemRepository;import net.rim.device.api.ui.UiApplication;import net.rim.device.api.ui.component.Dialog;import net.rim.device.api.ui.component.LabelField;import net.rim.device.api.ui.component.RichTextField;import net.rim.device.api.ui.container.MainScreen;

public class Bug49 extends UiApplication { public Bug49()    {     super();      Bug49Screen screen = new Bug49Screen();       pushScreen(screen);       ApplicationMenuItemRepository amir = ApplicationMenuItemRepository.getInstance();     Bug49NativeMenu bug49NativeMenu = new Bug49NativeMenu(0);     amir.addMenuItem(ApplicationMenuItemRepository.MENUITEM_PHONE, bug49NativeMenu ); }

  public static void main(String[] args) {      Bug49 b49 = new Bug49();      b49.enterEventDispatcher();   }

   static class Bug49Screen extends MainScreen {     public Bug49Screen() {            super();          setTitle(new LabelField("Hello"));            add(new RichTextField("Hello"));      } }

  static class Bug49NativeMenu extends ApplicationMenuItem  {     public Bug49NativeMenu(int order) {           super(order);     }     public Object run(Object context) {           if (context == null) {                Dialog.alert("context is null -- is this a bug?");            }         else {                Dialog.alert("context not null");         }         return null;      }     public String toString() {            return "Bug 49";      } }}

It is a problem in the version of BlackBerry device software 4.6.0.  It has been fixed in version 4.7.0.

Tags: BlackBerry Developers

Similar Questions

Maybe you are looking for