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
New Developer
poiuytrez
Posts: 41
Registered: ‎09-22-2009
My Device: Not Specified

Blackberry App still running

I am developing a simple app for blacberry with eclipse. I have just set up a ListField with a call back and then my app don't want to stop running after I close it. One very annoying consequence is that I have to reboot the simulator each time I want to test my app.

Thank you for your help :smileyvery-happy: !

public class MyMainScreen extends MainScreen {
   
private ListField lfMessage;                        // UI list of messages
   
// Constructor
   
public MyMainScreen() {
       
// set the title
        setTitle
("My App");
       
ListField lfMessage;
        lfMessage
= new ListField();
        lfMessage
.setEmptyString("Nothing to see here", DrawStyle.LEFT);
        lfMessage
.setSize(5);
        lfMessage
.setCallback(new MessageListCallBack());
        add
(lfMessage);

   
}

   
// Menu item "Close"
   
private MenuItem closeItem = new MenuItem("Close", 110, 10) {
       
public void run() {
        lfMessage
.setCallback(null);
        lfMessage
= null;


        onClose
();
       
}
   
};
Developer
Posts: 43
Registered: ‎09-28-2009
My Device: Not Specified

Re: Blackberry App still running

Hi poiuytrez,

 

Use the method "close()" instead of "onClose()" in your MenuItem code. close() cleans up the application stack and calls System.exit(0), whereas onClose() is a predelimeter used for cleaup/saving/etc to close() and does not actually call close().

 

Hope this fixes your problem

 

Regards

Developer
kumaresan
Posts: 183
Registered: ‎12-17-2008
My Device: 8320

Re: Blackberry App still running

want to run background after click back button use 1.

want to exit the applcation use 2. 

 

1.

public boolean onClose()
{
        UIApplication.getUiApplication().requestBackground();
}

2.
public boolean onClose()
{
        System.exit(0);

     }   

kums

******************************

Press kudos which the post help you
Please mark posts as solved if you got a solution
New Developer
poiuytrez
Posts: 41
Registered: ‎09-22-2009
My Device: Not Specified

Re: Blackberry App still running

It does not seems to work better :'(.

 

Any other ideas ?

BlackBerry Development Advisor
MSohm
Posts: 14,753
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: Blackberry App still running

[ Edited ]
Calling System.exit should definitely close your application.  Can you post updated sample code that shows what you are doing?
Message Edited by MSohm on 10-01-2009 03:43 PM
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker