Enhance contentproviders

PerfectCarl edited this page Dec 29, 2013 · 8 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;

  @OrmLiteDao(helper = DatabaseHelper.class, model = User.class)
  UserDao userDao;

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

  // ...
}

14/10/2018 The 4.5.1 release is out !

Using AndroidAnnotations

Questions?

Enjoying AndroidAnnotations

Improving AndroidAnnotations

Extending AndroidAnnotations

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.