android application

Solutions on MaxInterview for android application by the best coders in the world

showing results for - "android application"
Marie
17 Jan 2019
1import android.app.Application;
2
3public class MyApplication extends Application {
4    // Called when the application is starting;
5    // before any activity, service, or receiver objects have been created.
6	@Override
7	public void onCreate() {
8	    super.onCreate();
9        // your code here
10	}
11}
12
13in the AndroidManifest.xml:
14
15<application 
16    android:name=".MyApplication"
17    ...>
18
19get application object in other parts of the code:
20
21MyApplication app = (MyApplication) getApplication();
22