The answer is There is Simply No Direct method to do this
rather than in Application Class you can catch these events
@Override
public void onLowMemory()
{
super.onLowMemory();
}
@Override
public void onTerminate()
{
super.onTerminate();
}
So you will have to handle it in all the Activities you will be having
the following methods
- onResume()
- onStart()
- onRestart()
- onPause()
- onDestroy()
You will have to implement in all Activity to handle for all application
A suggesstion
You can have some Variable in Application class to save application state
say create a variable like
public static boolean isPaused;
and set it from all activity on state change