2013年6月22日
摘要: 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 阅读(932) 评论(0) 推荐(0)
摘要: 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 阅读(1518) 评论(0) 推荐(0)
摘要: 注入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 阅读(624) 评论(0) 推荐(0)
摘要: 代替繁琐的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 阅读(915) 评论(0) 推荐(0)
摘要: 线程使用:@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 阅读(916) 评论(1) 推荐(0)
摘要: 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 阅读(1081) 评论(0) 推荐(0)
摘要: 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 阅读(3569) 评论(0) 推荐(0)
摘要: 转自一个外文不错的博客,非常值得一看。http://www.vogella.com/articles/AndroidServices/article.htmlAndroid Service TutorialLarsVogelVersion 2.6Copyright © 2011, 2012, 2013 Lars Vogel22.05.2013Revision HistoryRevision 0.107.03.2011LarsVogelcreatedRevision 0.2 - 2.608.03.2011 - 22.05.2013LarsVogelbug fixed and enhan 阅读全文
posted @ 2013-06-22 11:59 lee0oo0 阅读(1138) 评论(0) 推荐(0)