Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 37
Registered: ‎10-17-2008
My Device: Not Specified
Accepted Solution

ApplicationMenuItem called back with null in JDE 4.6 when entering phone number

When I install a custom ApplicationMenuItem to the Phone application, and

try to enter a number on the native dialer keypad and click the custom menu,

my custom ApplicationMenuItem is called back with a null context object.

 

This same code + test case is working fine under the JDE 4.5 / 8300 emulator

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

and device

 

To reproduce bug:

 

* Build/launch attached test application

* Send to background with the back key

* Go to native dialer

* Enter "123" on phone keypad

* Click trackball

* Choose Bug49 from popup menu

* It will popup a dialog that says "context is null -- is this a bug?"

 

NOTE that if instead of entering a number on the phone keypad in step 4,

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

 

 

Is there anything I can do to make this work?  if this is a known bug, are

there any workarounds?

 

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";
}
}
}

 

 

 

BlackBerry Development Advisor
Posts: 15,055
Registered: ‎07-09-2008
My Device: BlackBerry Passport
My Carrier: Bell

Re: ApplicationMenuItem called back with null in JDE 4.6 when entering phone number

This is an issue in version 4.6.0 of BlackBerry handheld software.  It has been fixed in version 4.7.0.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Contributor
Posts: 6
Registered: ‎02-26-2010
My Device: 8900 4.6.1
My Carrier: Digitel

Re: ApplicationMenuItem called back with null in JDE 4.6 when entering phone number

Hi Mark:

 

It's ok that in Version 4.7, this issue has been fixed.

But, in my country, most of the BB Software versions are 4.5.X or 4.6.x (Even lower), so I'm forced to develop the application in older versions.

 

So, I'm having the same problem:

 

We've installed a system for a telco that makes an "special" call taking the phone number from the contacts library. It works fine at the contacts list, but not at the native dialer menu.

 

So, is there any way of detecting the contact or number from the native dialer app (phone) in older releases or having context set to null?? Some way to get into the "net.rim.device.apps.internal.phone.PhoneNumberKeywordList" or some?

 

Thanks in advance!

 

Aníbal Itriago

Visitor
Posts: 1
Registered: ‎04-23-2010
My Device: 9500
My Carrier: 3G

Re: ApplicationMenuItem called back with null in JDE 4.6 when entering phone number

This is an issue in version 4.6.0 of BlackBerry handheld software.  It has been fixed in version 4.7.0.

 

It is not fixed in 4.7 !?

I ran the previous example "Bug49" on simulator 4.7.0.75. Even more I load the example application on 9500 and result is the same as simulator - I see message "Dialog.alert("context is null -- is this a bug?");"

 

Please comment!

Regular Visitor
Posts: 1
Registered: ‎05-17-2010
My Device: T Mobile
My Carrier: programmer

Re: ApplicationMenuItem called back with null in JDE 4.6 when entering phone number

Hi

 

this is my code:

 

public class ReplyMenuItemNMB extends ApplicationMenuItem {

        public static String phoneNumber = null;
        public static boolean isReplyMenuItemNMB = false;

        public ReplyMenuItemNMB() {
                super(602880);
        }

        public Object run(Object o) {
                if (o == null) return null;
                if (o instanceof Message || o instanceof TextMessage) {

                ...

                ...

                ...

         }
                return null;
        }

        public String toString() {
                return "Reply SMS";
        }
}

 

He is working on version 4.6 (ApplicationMenuItem called back with object) but not working on version 5.0 (ApplicationMenuItem called back with null).

 

Please help me.

 

Developer
Posts: 638
Registered: ‎07-02-2009
My Device: Not Specified

Re: ApplicationMenuItem called back with null in JDE 4.6 when entering phone number

One more update,

 

I tested the same code in on BB OS 5.0, 9550 simulator ( v5.0.0.334). the same bug reproduced.

Thanks and Regards,
PraveenGoparaju.
Developer
Posts: 1,540
Registered: ‎07-14-2008
My Device: Z10
My Carrier: Fido

Re: ApplicationMenuItem called back with null in JDE 4.6 when entering phone number

this problem is on going from OS to OS to newer OS and yet RIM never really addressed this bug.

 

I'm also having this problem with the call log and sms app.