classe d'application Android
// Create a subclass of Application
// Application.onCreate() will be invoked when the app starts
public class ExampleApplication extends android.app.Application {
public void onCreate() {
super.onCreate();
Log.i("ExampleApplication", "Application Started");
}
}
// Register the Application subclass in the manifest
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.app">
<application
android:name=".ExampleApplication"
...>
// Get application object in other app components:
ExampleApplication app = (ExampleApplication) getApplication();
Merlin4 (personal)