Iphone - App Terminate vs Run In Background
===

I am confused which one of these methods does what function.
    
    - (void)applicationWillResignActive:(UIApplication *)application {
    }
    
    
    - (void)applicationDidEnterBackground:(UIApplication *)application {
    }
    
    
    - (void)applicationWillEnterForeground:(UIApplication *)application {
    }
    
    
    - (void)applicationDidBecomeActive:(UIApplication *)application {
    }
    
    
    - (void)applicationWillTerminate:(UIApplication *)application {
        }

I've tried messing around with them because I want my app to do some actions right before it exits if the home button was pressed (the only button on the ipad.  I'm not sure if thats the right name for it) and also once it re-opens.  Could anyone give me a quick summary of when to use each one of these/when they are called by my app.  Thank you!