09-24-2010 03:27 PM
I am having a problem - maybe with the simulator for 9800. The following code works fine on 9700 simulator, but only works on 9800 simulator when I turn on the option, Run Configuration > Simulator > Debugging > "Do not stop execution when an exception is caught by catch(Throwable)" is turned on. I am getting the "JVM Error 104 Uncaught: NullPointerException" message and halt. If I check the box above or use the 9700 simulator I have not problems and the app works as expected. Please help!
I am simply trying to have the phone dial a number on a context menu.
import net.rim.blackberry.api.invoke.Invoke; import net.rim.blackberry.api.invoke.PhoneArguments; import net.rim.blackberry.api.menuitem.ApplicationMenuItem; import net.rim.blackberry.api.menuitem.ApplicationMenuIte mRepository; import net.rim.device.api.ui.component.Dialog; public class CallHelpDesk { public CallHelpDesk() { ; } public static void main(String[] args) { CallHelpDeskItem callHelpDeskItem = new CallHelpDeskItem(0); ApplicationMenuItemRepository.getInstance().addMen uItem(ApplicationMenuItemRepository.MENUITEM_CALEN DAR_EVENT, callHelpDeskItem); } } class CallHelpDeskItem extends ApplicationMenuItem { CallHelpDeskItem(int order) { super(order); } public Object run(Object context) { PhoneArguments makeCall = new PhoneArguments(PhoneArguments.ARG_CALL, "800-123-4567"); try { Invoke.invokeApplication(Invoke.APP_TYPE_PHONE, makeCall); } catch (Exception e) { Dialog.alert(e.toString()); } Dialog.alert("Success"); return context; } public String toString() { return "Call Helpdesk"; } }
09-24-2010 04:49 PM
Just replying to myself here. . . .I did find that I can continue AND the next time I click I do not get the error - only the first time. Not sure how to troubleshoot further.
09-24-2010 05:08 PM
This is an issue with the BlackBerry Smartphone Simulator, not with your application. You shouldn't see this on a real BlackBerry Smartphone either.