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: 59
Registered: ‎07-01-2009
My Device: Android HTC One X
My Carrier: Cellcom
Accepted Solution

Close and notifyDestroyed just send the app to the background

notifyDestroyed just sends my MIDlet to the background, but the app is still running. Further more, choosind Close from the BB menu (invoked by pressing the app key) also does not close the application. What am I doing wrong?
Developer
Posts: 59
Registered: ‎07-01-2009
My Device: Android HTC One X
My Carrier: Cellcom

Re: Close and notifyDestroyed just send the app to the background

More quirks - System.exit(0) also doeswnt do the trick. Any idea?
Developer
Posts: 59
Registered: ‎07-01-2009
My Device: Android HTC One X
My Carrier: Cellcom

Re: Close and notifyDestroyed just send the app to the background

[ Edited ]
More quirks - the application does not apper on the task switch menu, but when restarting it - it continues exactly where I've stopped it last time and does not actually restart.
Message Edited by vaiden on 07-16-2009 02:25 PM
Developer
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Close and notifyDestroyed just send the app to the background

Have you tried setting the Display to Null before exiting.

Use Search. "Accept Solution" If the problem is resolved.
Developer
Posts: 59
Registered: ‎07-01-2009
My Device: Android HTC One X
My Carrier: Cellcom

Re: Close and notifyDestroyed just send the app to the background

Yes. Also killed all simgletons, stopped all communication, located all reference loops, nulled all MIDlet refernces. Still no good.
Highlighted
Developer
Posts: 59
Registered: ‎07-01-2009
My Device: Android HTC One X
My Carrier: Cellcom

Re: Close and notifyDestroyed just send the app to the background

[ Edited ]

OK. Finally fixed this!

It appears that the PushRegistry mechanism was still alive in the background, not allowing the application to close gracefully. More specifically: RIM's helper thread MIDletMain.MIDletPushRegistryWorkerThread was deadlocked. I have no idea why and frankly I don't have time to investigate it. For now I just shut down PushRegistry and the app quits fine.

 

I think deserve a Kudos for this, if only for my Ego's sake... nudge... nudge...

 

Aa I understand, there are quite a few people who ran into similar problems, where MIDlets won't quit on BlackBerry. So I thought I'd elaborate on how I located the solution:

I ran the app in the Eclipse debugger, then quit it and looked at the lis of active threads. Normally, after quitting the app., all associated threads should die. So, one of the remaining threads associated with the app. is the culprit:

 

eclipse-debug.JPG

Message Edited by vaiden on 07-19-2009 03:55 PM
Message Edited by vaiden on 07-19-2009 03:56 PM
New Developer
Posts: 2
Registered: ‎09-02-2009
My Device: Not Specified

Re: Close and notifyDestroyed just send the app to the background

Hi! Did you succeed to find solution of this problem? I have the same problem on 8310. I have connection registered staticly in JAD, so notifyDestroyed and also System.exit() just send the app to the background. The same problem is when I registered this connection not in JAD but dynamically. For the problem will be pure, I removed all the code regarding the connection, leaving just static (or dynamic) registration. If in destroyApp I call (just for check) PushRegistry.unregisterConnection(), application is closed normally. But I need using of PushRegistry, so I don't want call PushRegistry.unregisterConnection(), I want AMS will listen  for inbound communication. Any solution?