Skip to content

Enhancing the Application class

Pierre-Yves Ricau edited this page Feb 2, 2012 · 3 revisions

Since AndroidAnnotations 2.4

You can enhance your Android Application class with the @EApplication annotation:

@EApplication
public class MyApplication extends Application {

}

You can then start using most AA annotations, except the ones related to views and extras:

@EApplication
public class MyApplication extends Application {

  public void onCreate() {
    super.onCreate();
    initSomeStuff();
  }

  @SystemService
  NotificationManager notificationManager;

  @Bean
  MyEnhancedDatastore datastore;

  @RestService
  MyService myService;
 
  @Background
  void initSomeStuff() {
    // init some stuff in background
  }
}

Wiki

Using AndroidAnnotations

Questions?

Developing AndroidAnnotations

Misc

Clone this wiki locally