08-08-2008 02:52 AM
Hello:
I've developed an application in J2ME with Netbeans. It runs Ok in all phones, but when i recompiled the .jar to obtain the .cod, the application runs ok in Blackberry (8120) excepts for a command that i called "Call" that runs:
private void callMaker() {
boolean mustExit;
try {
mustExit = this.platformRequest("tel:902222222");
if (mustExit) {
this.destroyApp(true);
this.notifyDestroyed();
}
} catch (Exception e) {/*e.printStackTrace();*/}
}
Why?
08-08-2008 04:36 AM - edited 08-08-2008 04:38 AM
hi,
I did have a smilar problem when calling the platformrequest from a thread (MIDlet based application).
you may try the following:
// Explaination: added cause the platformRequest did thrown an exception
// "RuntimeException: pushModalScreen called by a non-event thread"
// when called from a thread (cause is not the BB event thread)
UiApplication.getUiApplication().invokeLater(
new Runnable() {
public void run() {
try {
platformRequest(r);
//We assume that BB Device don't need to close the Midlet in order to process a phone call / web browser.
} catch (Exception ex) {
}}
});
MUST be called from the main thread (I call it from the canvas.repaint) (you may want to implement a queue system)
oh, and this could be useful:
DoPlatformRequest(rqt, !net.rim.device.api.system.Application.isEventDisp
atchThread()); /* net.rim.device.api.system.Application.isEventDispa tchThread() == true * from thread Draw/KeyPressed, but not from other thread. */
hopes this helps,