The
Application class is in the Android api and according to the class name
it's used for global settings or running entrance.
We
can specify its name in your AndroidManifest.xml's tag
<application android:icon="@drawable/icon"
|
We
can create our own subclass of Application like this:
public class MyApplication extends Application {
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
@Override
public void onCreate() {
super.onCreate();
}
@Override
public void onLowMemory() {
super.onLowMemory();
}
@Override
public void onTerminate() {
super.onTerminate();
}
}
Application level callbacks
- onConfigurationChanged( ) Called by the system when the device configuration changes while your component is running.
- onCreate( ) Called when the application is starting, before any other application objects have been created.
- onLowMemory( ) This is called when the overall system is running low on memory, and would like actively running processes to tighten their belts.
- onTerminate( ) This method is for use in emulated process environments. It will never be called on a production Android device, where processes are removed by simply killing them; no user code (including this callback) is executed when doing so.
No comments:
Post a Comment