Android快速开发工具:AndroidAnnotations:

00Android.jpg
github 地址: https://github.com/excilys/androidannotations
目标:
--加快安卓开发
--减少重复代码
--使开发者有更多的事件去思考核心业务代码
实现:
基于Java的注解原理,开发者直接使用注解展示他们的意图,然后AndroidAnnotations会自动帮我们生成代码,使得很多重复冗余的代码只需要一行代码就解决掉。
特征:
--1.依赖注入: inject(注解) views, extras, system services, resources, ...
--2.简化的线程模型:annotate your methods so that they execute on the UI thread or on a background thread.
--3.事件绑定:annotate methods to handle events on views, no more ugly anonymous listener classes!
--4.REST client:REST client: create a client interface, AndroidAnnotations generates the implementation
--5.AndroidAnnotations 这个工具比较小,低于150kb

Code Example:

==================================================

@EActivity(R.layout.translate) // Sets content view to R.layout.translate
public class TranslateActivity extends Activity {

@ViewById // Injects R.id.textInputEditText textInput;@ViewById(R.id.myTextView) // Injects R.id.myTextViewTextView result;@AnimationRes // Injects android.R.anim.fade_inAnimation fadeIn;@Click // When R.id.doTranslate button is clicked void doTranslate() {     translateInBackground(textInput.getText().toString());}@Background // Executed in a background threadvoid translateInBackground(String textToTranslate) {     String translatedText = callGoogleTranslate(textToTranslate);     showResult(translatedText);}@UiThread // Executed in the ui threadvoid showResult(String translatedText) {     result.setText(translatedText);     result.startAnimation(fadeIn);}// [...

}

更多相关文章

  1. 解决 Android(安卓)N 上报错:android.os.FileUriExposedException
  2. ContentProvider拾遗
  3. Android(安卓)studio button 按钮 四种绑定事件的方法【实例代码
  4. android上的JAVA8:使用retrolambda
  5. android创建optionsmenu的方法
  6. Android屏幕切换
  7. 小白学习android: google code 上源代码的下载方法
  8. Android(安卓)开发中使用Linux Shell实例详解
  9. Android(安卓)代码审计工具和常见问题

随机推荐

  1. 基于“ViewHolder”技术提升Android(安卓
  2. AnDroidDraw.apk的安装
  3. Android高手进阶教程(二十二)之---Androi
  4. Android常用布局及属性--LinearLayout
  5. 如何获取android源代码
  6. 【Android(安卓)Training UI】创建自定义
  7. ScrollView常用属性汇总
  8. android 3.0中加快启动模拟器
  9. Android中Bitmap和Drawable
  10. Android应用实例之----基于Service与Cont