Intro to Android

Application Lifecycle

onCreate()

Called when the application is starting, before any activity, service, or receiver objects (excluding content providers) have been created. Make it fast, this affects startup performance.

onLowMemory()

When the overall system is running low on memory, you use this to trim memory usage. Release any caches or other unnecessary resources you may be holding on to. The system will perform a garbage collection for you after returning from this method.

onTrimMemory()

Called when the operating system has determined that it is a good time for a process to clear up unneeded memory. This can happen when the application goes in the background and there is not enough memory to keep as many background processes running as desired.

onConfigurationChanged()

Called by the system when the device configuration changes while your component is running.

At the time that this function has been called, your Resources object will have been updated to return resource values matching the new configuration.