@EProvider加强contentprovider

原文地址:
https://github.com/excilys/androidannotations/wiki/Enhance-contentproviders

你可以使用@EProvider注释加强一个Android内容提供商与:

1
2
3
4
@EProvider
public class MyContentProvider extends ContentProvider {

}

然后,您可以开始使用大多数AA注释(除了相关的views和extras):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
@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();
}

// ...
}