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
superdirt
Posts: 541
Registered: ‎05-17-2009
My Device: Not Specified

Re: Previous instance still active

So far the error has occurred only after OTA install and it overwrites a version installed with javaloader. Not sure if this is related.
Please use plain text.
Developer
simon_hain
Posts: 15,937
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Previous instance still active

storing the whole instance in the runtimestore did not work for me.
It was done in some obscure RIM sample, but i would not do that.
I would strongly suggest not to do it.

I would also suggest to remove the args from the application constructor. It could lead to multiple instances of the app being created, i think.

change your main code to
MyApp app = new MyApp();
app.enterEventDispatcher();

and it should work.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
superdirt
Posts: 541
Registered: ‎05-17-2009
My Device: Not Specified

Re: Previous instance still active

Makes perfect sense. I'm making these changes.

Thanks for the help.
Please use plain text.
Developer
superdirt
Posts: 541
Registered: ‎05-17-2009
My Device: Not Specified

Re: Previous instance still active

I removed the args reference from the app constructor and I am still able to produce the error. Here is some more info:

 

- Using the debugger I can see that pressing the home screen icon while the application is already running doesn't execute public static void main again or the application's main constructor, even when the dialog shows.

- If I switch to another application using the task manager (holding the menu button for a second), and then return to the application through any flow (via home screen or task manager) the dialog doesn't display. In other words, the dialog only shows when the back button is pressed.

- The dialog doesn't display if I hit the hang-up button

- In the onClose() method of the screen I make this call to exitApp() on the event thread:

    public synchronized boolean exitApp() {
        UiApplication.getUiApplication().requestBackground();
        return false;
    }

 ... and onClose() will return false. I wonder if returning false could be an issue?

 

I can think of a possible hacky solution where I do a event injection for the Keypad.KEY_END key.

Please use plain text.
Developer
simon_hain
Posts: 15,937
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Previous instance still active

this could very well be related, yes.
return true if you want to consume the event, otherwise return super.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
superdirt
Posts: 541
Registered: ‎05-17-2009
My Device: Not Specified

Re: Previous instance still active

Consuming the onClose() using a true return didn't solve it. I decided to do an event injection when the escape key is pressed that simulates the end-call key being pressed. This seems to hide that popup dialog. I'm not proud of myself for doing it this way :smileysad: but it's all I have until I find out the cause.

 

Scott

Please use plain text.