SystemServices
Since AndroidAnnotations 1.0
Standard Android System Service injection
Retrieving Android System Services requires remembering the name of the constant, and casting the retrieved object.
获取Android System Service需要想起常量名,并且强制转换获得的对象。
notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
@SystemService
The
@SystemService
annotation
indicates
that an activity
field
should be injected with the corresponding Android
System service
.
@SystemService
注解表明activity
字段
应该由相应的Android
System service
注入。
It is the same as calling the
Context.getSystemService() method.
Usage example:用法:
@EActivity public class MyActivity extends Activity { @SystemService NotificationManager notificationManager; }