Andorid之Annotation框架初使用(七)
摘要:Save Instance State:程序保留Activity的实例状态 , 在onSaveInstanceState(Bundle)被系统调用的时候自动保存 ,onCreate(Bundle)被系统调用会重新修复。@EActivitypublic class MyActivity extends Activity { @InstanceState int someId; @InstanceState MySerializableBean bean;}设置没有Title:@NoTitlepublic class MyActivity extends Activity ...
阅读全文
posted @
2013-06-22 21:36
lee0oo0
阅读(930)
推荐(0) 编辑
Andorid之Annotation框架初使用(六)
摘要:EVENT@Click :点击事件,只能有0个或1个参数,且参数为View @Click(R.id.myButton)void myButtonWasClicked() { [...]}@Clickvoid anotherButton() { [...]}@Clickvoid yetAnotherButton(View clickedView) { [...]}@LongClick@TouchAdapterViewEvents@ItemClick 必须有一个参数,如果这个参数是object类型,意味着adapter.getItem(position) ; 如果是int ,意味...
阅读全文
posted @
2013-06-22 20:59
lee0oo0
阅读(1512)
推荐(0) 编辑
Andorid之Annotation框架初使用(五)
摘要:注入res文件夹的资源:@StringRes@EActivitypublic class MyActivity extends Activity { @StringRes(R.string.hello) String myHelloString; @StringRes String hello;}@ColorRes@EActivitypublic class MyActivity extends Activity { @ColorRes(R.color.backgroundColor) int someColor; @ColorRes int backgroundColor;}...
阅读全文
posted @
2013-06-22 17:01
lee0oo0
阅读(618)
推荐(0) 编辑
Andorid之Annotation框架初使用(四)
摘要:代替繁琐的finViewById@EActivitypublic class MyActivity extends Activity { // Injects R.id.myEditText @ViewById EditText myEditText; @ViewById(R.id.myTextView) TextView textView;}指定需要在视图加载完成后才能执行的方法@AfterViews@EActivity(R.layout.main)public class MyActivity extends Activity { @ViewById TextView...
阅读全文
posted @
2013-06-22 16:52
lee0oo0
阅读(910)
推荐(0) 编辑
Andorid之Annotation框架初使用(三)
摘要:线程使用:@Background这个是使用了cachedthread pool executor , 阻止开启过多的线程可以为@Background指定一个id,用于随时终止线程的操作(BackgroundExecutor.cancelAll())void myMethod() { someCancellableBackground("hello", 42); [...] boolean mayInterruptIfRunning = true; BackgroundExecutor.cancelAll("cancellable_task", mayIn
阅读全文
posted @
2013-06-22 15:57
lee0oo0
阅读(911)
推荐(0) 编辑
Andorid之Annotation框架初使用(二)
摘要:Fragment:@EActivity(R.layout.fragments)public class MyFragmentActivity extends FragmentActivity { @FragmentById MyFragment myFragment; @FragmentById(R.id.myFragment) MyFragment myFragment2; @FragmentByTag MyFragment myFragmentTag; @FragmentByTag("myFragmentTag") MyFragment myFragmentTag2;.
阅读全文
posted @
2013-06-22 15:44
lee0oo0
阅读(1075)
推荐(0) 编辑
Andorid之Annotation框架初使用(一)
摘要:1. 设置Activity的布局@EActivity(R.layout.main)public class MyActivity extends Activity {}注: 此时在AndroidManifest.xml 注册Activity需要: 2. 设置及使用Application设置:在AndroidManifest.xml也需要配置@EApplicationpublic class MyApplication extends Application {}使用:@EActivitypublic class MyActivity extends Activity { @App MyAp..
阅读全文
posted @
2013-06-22 15:20
lee0oo0
阅读(3565)
推荐(0) 编辑
配置Android-Annotation (github20大开源:http://www.eoeandroid.com/thread-278980-1-1.html)
摘要:1. 把androidannotations-X.X.X-api.jar 放在libs文件夹2. 把androidannotations-X.X.X.jar 放在文件夹compile-libs,1与2不能在同一目录3. 右键项目,选择Properties4. 确保java编译器是1.6或以上5. 前往java compiler 》Annotation Processing 选择 "enable annotation processing"6. 前往java compiler > Annotation Processing > Factory Path 添加JAR
阅读全文
posted @
2013-06-16 20:17
lee0oo0
阅读(1164)
推荐(0) 编辑