09-24-2013 11:42 PM
Hello, i just make blackberry application (os 5,6,7) but it has strange behaviour.
When i press switch application menu item, my application is close so i can't get back to my application once i switched to another application.
i have override my onClose to be like this
public boolean onClose()
// return true;
but the problem is still.
please help me how to solve this
Solved! Go to Solution.
09-25-2013 04:36 AM - edited 09-25-2013 07:29 AM
When you switch application, the close method is not driven directly so I think you are looking elsewhere for this
Try using the Switch Application with a sample application - say the sample HelloWorld app. I suspect it will not happen, which suggests that the problem is in your application.
There are three places to look:
a) The Application deactivate method is driven when the application is sent to the background. Perhaps you have coded this and it closes the application
b) You have some background type processing that checks (isForeground()) and reacts according to what it finds.
c) in the onObscured() method for one of theFields/Screen on display at the time. .
Other than that I think you are looking for a general bug in your application. The place to start is to look at the debug log when you do this - look for anything from your application that you consider odd.
09-25-2013 05:19 AM
thank you sir, finally i can found what make this application have strange behaviour.
yor point b) is the problems
actually this application is develope by many programmer,and someone place an system.exit(0) when MBApplication.getApplication().isForeground() is false. just like u said
09-25-2013 05:30 AM
Glad you found it.
Of course it might be useful to ask the programmer that put that in why it is there - there might be a case when you should exit the application!
Anyway, can you mark this as solved? Instructions and other useful information can be found in the Help link near the top of the screen.