If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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
Contributor
herahadi
Posts: 27
Registered: ‎02-20-2013
My Device: 9900
My Carrier: Telkomsel
Accepted Solution

App close when switch application menu item invoke

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()
    {
//        this.close();
//        return true;
//        UiApplication.getUiApplication().requestBackground();
        getApplication().requestBackground();
            return true;
    }

 

but the problem is still.

 

please help me how to solve this

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: App close when switch application menu item invoke

[ Edited ]

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. 

Please use plain text.
Contributor
herahadi
Posts: 27
Registered: ‎02-20-2013
My Device: 9900
My Carrier: Telkomsel

Re: App close when switch application menu item invoke

@peter_strange,

 

thank you sir, finally i can found what make this application have strange behaviour.

 

yor point b) is the problems :smileyvery-happy:

 

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 :smileyhappy:

 

thanks again

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: App close when switch application menu item invoke

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. 

Please use plain text.