简介EventBus是一个很棒的事件订阅与发布的框架,项目地址:https://github.com/greenrobot/EventBus。作用Android各个组件间的以接口的方式进行的通信问题:
1 增加了组件间的耦合,某个组件的修改可能会引起另一个组件的修改,因此灵活度不高。
2 充斥着大量样板话的代码:
定义接口和回调
管理监听器
在各个...
分类:
移动开发 时间:
2015-05-30 22:42:24
阅读次数:
251
本文参考了:http://greenrobot.me/devpost/android-custom-layout/
Android SDK中提供了很多UI组件,如RelativeLayout, LinearLayout等,使用自定义控件有两大优点:
1、通过减少View的使用来增加UI的显示效率
2、构建SDK中没有的控件
原文总结了4种自定义View,分别是Compo...
分类:
移动开发 时间:
2015-05-23 16:57:20
阅读次数:
288
添加EventBus
compile 'de.greenrobot:eventbus:2.4.0'或
直接下载jar包 |点击下载 注册和注销EventBus
@Override
protected void onStart() {
super.onStart();
//注册EventBus
EventBus.getDefault()...
分类:
其他好文 时间:
2015-05-22 15:16:12
阅读次数:
144
最近偶然在论坛上看了一个比较厉害的库EventBus,感觉使用起来很爽,不用考虑在Activity还是Fragment,不用担心是不是UI线程,随便怎么通信都行,有网友笑说这简直是Android开发中的第五大组件,通信起来像广播那样神通,但又比广播轻量级多了,所以在这里记下来,以后开发就方便多了。
项目地址:https://github.com/greenrobot/EventBus
...
分类:
移动开发 时间:
2015-05-19 22:41:40
阅读次数:
173
使用EventBus进行Fragment和Activity通信
本文介绍EventBus的基本使用,以及用于Fragment和Activity之间通信。
github地址: https://github.com/greenrobot/EventBus 版本是 EventBus-2.4.0 release
EventBus是基于订阅和发布的一种通信机制,使用流程如下:...
分类:
其他好文 时间:
2015-05-11 18:04:09
阅读次数:
144
概述
GreenDao是Android当中的高性能ORM框架。(其他的有OrmLite等)
项目地址:https://github.com/greenrobot/greenDAO
同时GreenDao还有一个子项目为GreenDao Code Generator:
GreenDao的核心类及其工作如下:
使用初始化
使用greendao添加greend...
分类:
移动开发 时间:
2015-04-30 14:18:55
阅读次数:
368
https://github.com/greenrobot/EventBusonEvent:如果使用onEvent作为订阅函数,那么该事件在哪个线程发布出来的,onEvent就会在这个线程中运行,也就是说发布事件和接收事件线程在同一个线程。使用这个方法时,在onEvent方法中不能执行耗时操作,如果...
分类:
移动开发 时间:
2015-04-19 14:40:10
阅读次数:
124
在使用Parcelable对android中数据的序列化操作还是比较有用的,有人做过通过对比Serializable和Parcelable在android中序列化操作对象的速度比对,大概Parcelable相比Serializable要快10倍左右、、、给一个连接可以瞅瞅他们序列化的区别http://greenrobot.me/devpost/android-parcelable-serializ...
分类:
移动开发 时间:
2015-04-13 16:47:51
阅读次数:
151
Parcelable和Serializable的区别 参考地址:http://greenrobot.me/devpost/android-parcelable-serializable/ 由于最终的区别在于Parcelable的序列化速度远远高于Serializable,故本人更倾向于使用Parce...
分类:
移动开发 时间:
2015-03-31 12:37:56
阅读次数:
126
EventBus 和Otto的区别
Otto is another event bus library for Android; actually it’s a fork of Guava’s EventBus. greenrobot’s EventBus and Otto share some basic semantics (register, post, unregister, …), but...
分类:
其他好文 时间:
2015-03-17 15:56:22
阅读次数:
203