Enhancing the Application class 优化Application类
2014-04-06 15:35
375 查看
目录(?)[+]
Enhancing the Application class 优化Application类
Injecting your application class注入你的Application类
本文档的简单示例下载
You can enhance your Android
你可以使用
注解优化你的Android
类:
You can then start using most AA annotations, except the ones related to views and extras:
然后你就可以使用大部分的AA注解,除了一些Views和extra相关的注解:
Since AndroidAnnotations 2.1
You can inject the application class using the
你可以用
注解注入你的Application类:
It also works for any kind of annotated component, such as
在任何其他注解组件中,比如
Since AndroidAnnotations 3.0, the application class
must be annotated with
Enhancing the Application class 优化Application类
Injecting your application class注入你的Application类
本文档的简单示例下载
Enhancing the Application class 优化Application类
Since AndroidAnnotations 2.4You can enhance your Android
Applicationclass with the
@EApplicationannotation:
你可以使用
@EApplication
注解优化你的Android
Application
类:
@EApplication public class MyApplication extends Application { }
You can then start using most AA annotations, except the ones related to views and extras:
然后你就可以使用大部分的AA注解,除了一些Views和extra相关的注解:
@EApplication public class MyApplication extends Application { public void onCreate() { super.onCreate(); initSomeStuff(); } @SystemService NotificationManager notificationManager; @Bean MyEnhancedDatastore datastore; @RestService MyService myService; @Background void initSomeStuff() { // init some stuff in background }}
Injecting
your application class注入你的Application类
Since AndroidAnnotations 2.1You can inject the application class using the
@Appannotation:
你可以用
@App
注解注入你的Application类:
@EActivity
public class MyActivity extends Activity {
@App
MyApplication application;
}
It also works for any kind of annotated component, such as
@EBean:
在任何其他注解组件中,比如
@EBean,都可以使用:
@EBean
public class MyBean {
@App
MyApplication application;
}
Since AndroidAnnotations 3.0, the application class
must be annotated with
@EApplication.
本文档的简单示例下载
相关文章推荐
- AndroidAnnotations——Enhance custom views 优化自定义组件
- Android 音乐播放器实现歌词显示
- AndroidAnnotations——Enhance Fragments 优化Fragments
- AndroidAnnotations——Enhance activities 优化Activities
- AndroidAnnotations——Annotation recipes 注解使用方法
- AndroidAnnotations——How It Works,AndroidAnnotation是如何工作的
- Androidannotations——Home主页,了解AndroidAnnotations
- Androidannotations——开源框架简介&简易使用准备
- Android之SQLite
- iOS KVC/KVO
- 获取ios可用的系统字体以及名字
- Android多媒体开发 音乐播放(加带进度条、时间显示)以及使用SoundPool播放音效
- android中的广播接收实现总结
- Android 自定义Application
- android项目中配置NDK自动编译生成so文件
- 创建android Notification
- android 软件栈知识分享
- 一般物体检测--Binarized Normed Gradients for Objectness Estimation at 300fps
- Android中得到view在父容器中的位置下标
- Android中得到view在父容器中的位置下标