Skip to content

Enhance contentproviders

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

Since AndroidAnnotations 2.4

You can enhance an Android Content Provider with the @EProvider annotation:

@EProvider
public class MyContentProvider extends ContentProvider {

}

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

@EProvider
public class MyContentProvider extends ContentProvider {

  @SystemService
  NotificationManager notificationManager;

  @Bean
  MyEnhancedDatastore datastore;

  @UiThread
  void showToast() {
    Toast.makeText(getContext().getApplicationContext(), "Hello World!", Toast.LENGTH_LONG).show();
  }

  // ...
}

Using AndroidAnnotations

Questions?

Enjoying AndroidAnnotations

Improving AndroidAnnotations

Clone this wiki locally