Thank you for visiting the BlackBerry Support Community Forums.
BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)
BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.
"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."
- Kevin Michaluk, Founder, CrackBerry.com
Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.
08-27-2010 12:33 AM
I wanted to know whether onClose() is called by default when we press back / escape button. This is a very strange problem for me as this was not happening few days back. Although some time back I messed up my code by implementing Key Listener since I wanted to close the screen when escape is pressed. Now I have removed KeyListener from my code but its effect still remains. I have kept onClose since I want the user to go out he presses a button.
Solved! Go to Solution.
08-27-2010 12:38 AM
The framework will call onClose() in response to the escape key if the screen has the DEFAULT_CLOSE style bit set. For the escape key to work, you need to include DEFAULT_CLOSE whenever you explicitly set the style for your screen.
08-27-2010 01:07 AM
I was talking about Screen.DEFAULT_CLOSE. However, I read your initial post incorrectly. You should specify a style that does not include DEFAULT_CLOSE.
An alternative (and probably better) way is to override onClose(). Put your logic there about when to close the screen and when to do something else. (I think users usually expect the ESC key to work like a "back" button. You should think carefully about the wisdom of changing this.)