07-30-2011 09:14 AM
Hi All,
I know that there are thousand of posts about this,but I want to know is there any way to when application exit from anywhere,I mean no mather what is current screen when end call button is presing I want to exit application.Or I must provide onClose function to every screen?
07-30-2011 11:08 AM
System.exit(0)
...will exit from anywhere in the applicaiton.
07-30-2011 11:11 AM
I know.I just don't want to write onClose,keyDown or keyChar code for each screen.
I asked if there any general way to put some code and don't bother about writing any more code elsewere.
07-31-2011 11:41 AM
MainScreen will anatomically close the application if you close the last screen in the DisplayStack.
So if you start with one MainScreen and then push another MainScreen , then closing that second MainScreen will correctly display the first MainScreen underneath, But closing the first MainScreen will exit the app.
Alternatively, start on the first MainScreen , when you push the second MainScreen , if you also pop the first MainScreen, the closing the second one will close the app.
That said, I think this is bad practice, I recommend you create a general exit point for your application and make sure it always goes through this. That way it can tidy up any resources that it needs to.
07-31-2011 05:36 PM
Thanks Peter, I did the following in each main screen I overrides the keydown event and in it I check if the end call button is pressed then I call my custom function which will pop screens until the first one and after that exit application.However I don't like this approach.