Android事件总线分发库EventBus的简单讲解与实践
导语,EventBus大家应该不陌生,EventBus是一款针对Android优化的发布/订阅事件总线。主要功能是替代Intent,Handler,BroadCast在Fragment,Activity,Service,线程之间传递消息.优点是开销小,代码更优雅。以及将发送者和接收者解耦。反正能帮助我们快速开发,这个确实是个好东西,其...
分类:
移动开发 时间:
2016-05-12 17:49:55
阅读次数:
241
一、概述
EventBus是一款针对Android优化的发布/订阅事件总线。主要功能是替代Intent,Handler,BroadCast在Fragment,Activity,Service,线程之间传递消息.优点是开销小,代码更优雅。以及将发送者和接收者解耦。
1、下载EventBus的类库
源码:https://github.com/greenrobot/EventBus
2、...
分类:
其他好文 时间:
2016-05-12 14:13:27
阅读次数:
240
/**************************************************
WZASUST2016
备注:必要的配置
运行java文件后产生class文件最后运行浏览器
需要删除原有的class文件而且浏览器具有记忆功能需要关闭再来等待3秒就能在基本页面加载后加载APPLETjava控制台然后必要时请点击运行。
*******..
分类:
移动开发 时间:
2016-05-11 20:07:45
阅读次数:
342
/*************************
*http://www.tuicool.com/articles/Aza2Qz
*http://c.biancheng.net/cpp/html/2808.html
http://anycodes.cn/zh/
************************/
publicclassHelloWorld{
publicstaticvoidmethod1(intnum){
inti,j;
for(i=1;i<=num;i++){
for(j=1;j&..
分类:
其他好文 时间:
2016-05-11 08:14:46
阅读次数:
108
/*****************************
复杂度:
***************************/
#include<iostream>
#include<assert.h>
#include<vector>
#include<stdlib.h>
#include<time.h>
usingnamespacestd;
#defineN1000
#defineK100
voidAdjustDown(int*a..
分类:
其他好文 时间:
2016-05-10 23:54:53
阅读次数:
391
/********************
http://www.anycodes.cn/zh/
********************/
importjava.text.ParseException;
importjava.text.SimpleDateFormat;
importjava.util.Calendar;
importjava.util.Date;
importjava.util.Scanner;
publicclassHelloWorld{
publicstaticvoidmain..
分类:
其他好文 时间:
2016-05-10 23:48:30
阅读次数:
183
/********************
WZASUST2016代码与反思
********************/
#include<iostream>
#include<assert.h>
#include<vector>//容器--类模板
#include<stdlib.h>//利用随机值
#include<time.h>
usingnamespacestd;
#defineN1000
#defineK1..
分类:
其他好文 时间:
2016-05-10 23:46:05
阅读次数:
292
#include<iostream>
usingnamespacestd;
typedefstructnode
{
intx;
node*lc;
node*rc;
node(){}
node(intxx){x=xx;lc=NULL;rc=NULL;}
}*BiTree;
//intss[]={1,2,3,0,0,4,0,0,5,6,0,0,7,0,0};intsi=0;
//intss[]={1,2,-3,0,0,-4,0,0,5,-6,0,0,7,0,0};intsi=0;//sum=7
..
分类:
其他好文 时间:
2016-05-08 20:06:16
阅读次数:
179
#include<iostream>
usingnamespacestd;
intfindx(int*xx,intx,intn)
{
//assert(xx);
intl=0;intr=n;intmid=r/2;
if(xx[l]==x)returnl;
if(xx[mid]==x)returnmid;
if(xx[r]==x)returnr;
if(xx[l]<xx[mid])r=mid;
elsel=mid;
if(xx[l]<x&&x<xx[r]);
e..
分类:
其他好文 时间:
2016-05-08 20:05:34
阅读次数:
255
原型模式:
优点:
使用拷贝比new一个对象的开销要小
代码示例:
Prototype.h
#ifndef PROTOTYPE_H
#define PROTOTYPE_H
/**
*1、声明一个抽象基类,并定义clone()函数为纯虚函数。
*2、实例化各个子类,并且实现复制构造函数,并实现clone()函数
*/
class Resume
{
public:
...
分类:
其他好文 时间:
2016-05-07 10:26:49
阅读次数:
153