Override this method to save your object
@Override
public Object onRetainNonConfigurationInstance()
{
if (myObject != null) // Check that the object exists
return(myObject);
return super.onRetainNonConfigurationInstance();
}
Use this code within your onCreate() method to reload your object.
if (getLastNonConfigurationInstance() != null)
{
table = (Table)getLastNonConfigurationInstance();
This will save your object if your phones shuts your app off to save memory or your phone sleeps. Pressing back/closing your object will not save it. You can either prompt the user to press the home button instead or press the back button again to quit using onBackPressed() or use SQL to permanently store the data within your object.