Search code examples
java-menokiaj2mepolishnokia-s40

J2ME "notifyDestroyed()" is not working properly on Nokia 501


I am writing a game using J2ME. I am having a problem in notifyDestroyed() method.
When I exit the game from main menu it shows me exit confirmation screen I created, when I say yes by pressing LSK (Left Soft Key) where I have called the notifyDestroyed() method, Game dose not exit. This is my code called on LSK

protected void destroyApp(boolean arg0) throws MIDletStateChangeException
{
 notifyDestroyed();
}

I have implemented only 1 thread in game,on the exit,I have Removed sounds, RMS, and have unloaded all the resources but still its not working

This is working correctly for other devices (Samsung,Motorola,BB,LG )of mine except Nokia Asha 501. Can anybody help me how to solve this issue? Thank you


Solution

  • You say you call notifyDestroyed() when you press Left Soft Key? So, you have a keyPressed(int kc) method that calls notifyDestroyed()?

    If yes, don't do it like that. The only place you should call notifyDestroyed() is in the destroyApp() method, after you've done whatever cleaning up you feel like doing. In your keyPressed() method you should call destroyApp(true) instead.