[Appli exit] How to execute code before exiting application?

Put your problem here if it does not fit any of the other categories.

[Appli exit] How to execute code before exiting application?

Postby Syl » Tue Nov 17, 2009 11:29 am

I develop an application with several activities.

When the application starts, it goes into InitActivity and it makes some initializations.
For example, it starts a thread that sends periodically a network request toward a server (keep-alive mechanism).


My problem is "how to process operations before exiting the application ?" (typically, to stop the keep-alive thread).
My idea is to make a forward to an ExitActivity before exiting.


It would be easy if I had only one activity in my app. I would use onCreate() and onDestroy() methods to process init and end operations.


I manage to handle BACK Key press (using onKeyDown() method in the activities) but I don't manage to catch the HOME key...

Do you know how to execute code just before exiting the application ?

Thanks for you help !
Syl
Junior Developer
Junior Developer
 
Posts: 14
Joined: Wed Oct 21, 2009 11:03 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 29 guests