Reputation: 800
I want to save my all data to sdcard when my application closes, i've write a class to save my all data but i cannot detect when/where my aplication close or terminate event so i do not know where should i call my Data save class.
Thanks for any help.
Upvotes: 0
Views: 3084
Reputation: 2311
How about making your own base class that extends Activity and override the onPause, onStop, and onDestroy methods there, then make your activities extend your new base class?
Upvotes: 3
Reputation: 378
When your Activity is closed, it's onPause(), onStop() and onDestroy() methods will be called, so simply override one of them and save it there.
Check this out: http://developer.android.com/reference/android/app/Activity.html
Upvotes: 3