EventBus 的使用方法
来源:互联网 发布:傲剑弓箭升级数据 编辑:程序博客网 时间:2024/06/09 13:53
当EventBus在多个地方用到,而且传的参数又不一样的时候。比如传的标签有int 值,String 值,boolean值的时候。用法如下
一般的用法是在onCreate和onDestory两个方法里面注册和解注。
EventBus.getDefault.register(this);和EventBus.getDefault.unregister(this);
创建一个新类,EventUtil
设置int值的标签。
在设置标签的判断。
后面再写判断的类型(可以为对象)。
同时,需要在接收消息页面注册EventBus,在onEvent方法里对type进行判断,这样做的目的就是只取自己需要的参数。
这样做的目的就是在消息传递和接收的时候更加方便和简单。
阅读全文
0 0
- EventBus 的使用方法
- EventBus的使用方法
- eventbus的简单使用方法
- EventBus 的使用方法
- EventBus使用方法
- Android事件总线纷发库EventBus的使用方法
- EventBus 3. 0 使用方法
- EventBus基本使用方法
- 暴雨夜初探EventBus使用方法
- Android-->EventBus 3.0新版使用说明(及其使用方法)
- Android 效率开发之EventBus新使用方法
- Android-->EventBus 3.0新版使用说明(及其使用方法)
- Android-->EventBus 3.0新版使用说明(及其使用方法)
- EventBus 3.0新版使用说明(及其使用方法)
- Android-->EventBus 3.0新版使用说明(及其使用方法)
- Android-->EventBus 3.0新版使用说明(及其使用方法)
- EventBus 《二》 Android EventBus的简单使用
- EventBus的使用初试
- html字符转义
- 写一个Java应用程序,从键盘输入一个整数,然后输出它的平方值立方值
- jenkins 构建打包android app
- 阶乘取模预处理
- 程序员如何成为别人的男朋友
- EventBus 的使用方法
- go语言学习及json学习
- 单例设计模式
- c++11新特性
- Easyui-ComboTree数据填充,递归。树形节点
- NYOJ题目37-回文字符串
- C++输出数据到TXT文档中
- Nginx 405 method not alllowed
- 应届毕业生迟迟找不到工作,是否因为自视太高?怎样调整找工作的心态?