Hi,
I want to display some msg before the user exit the application. How to detect application exit?
Hi,
I want to display some msg before the user exit the application. How to detect application exit?
Hello,
You either call your message display in destroyApp() method of your midlet.
OR
in commandAction() method inside the command from where you are exiting/closing the midlet.
Regards,
Dinanath
It's a matter of attitude.
ok.. destroyApp works.. how to prevent the application from closing at destroyApp? I want to do something like... they user need to enter a correct password before they can exit the application.
On which device you are trying it, most you prevent the call to Destory app() when presses the red key for exit.
But in case it's you own apps Exit Command, then you can ask this password before call the Destory app().
thanks,
Ekta
Avoid doing anything time consuming in destroyApp(). Some devices will limit the amount of time for which destroyApp() is permitted to run, so that destroyApp() cannot block application exit. If the argument to destroyApp() is true, then you cannot stop the application from terminating. If false, then you can throw a MIDletStateChangeException. However, on a red-key exit, the argument will be true, and you will not be able to prevent exit.
If you simply want a confirmation message when the user picks "exit" from your application's menu, then handle the dialogue as a normal part of the user interface, don't use destroyApp().
Graham.
Yes! That's exactly what I wanted. Besides exiting the application from the menu command, the user can actually also exit the application by pressing the red key! therefore, I want to display a confirmation dialogue and prevent a call to destroy app if the user do not actually want to exit the application. How to prevent a call to Destroy App()? I am trying on N95 8GB
You cannot prevent the application from being destroyed.
Preventing an application from being destroyed would present a security issue, as well as compromising platform stability. For these reasons, a MIDlet can always be shutdown by the system.
Graham.