Skip to content

Enhancing the Application class

pyricau edited this page Jan 26, 2012 · 6 revisions

Since AndroidAnnotations 2.3

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;

  @Inject
  MyEnhancedDatastore datastore;

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

Using AndroidAnnotations

Questions?

Enjoying AndroidAnnotations

Improving AndroidAnnotations

Clone this wiki locally