I have requirement that needs to save data to a file. During multiple Activitiy screens, I add different data to a list
and finally when user is not using the app (means if user exits app by pressing "home" button or "call" button), just before exiting that app, i want to save that data of the list to a file.
coding before exiting activity screen is simple - by calling onDestory() method, but here I want not one activity but the application exit.
So my question is How do I write a code that will be executed just before application exits ?
I tried created one class extends Application, and then I override onTerminate() method, but it's not get called when I exit ( pressing home button on device)