Android 用代理模式处理海量高频数据更新
2010-12-18 08:04:10 来源:WEB开发网业务背景: 海量高频数据(如股票实时报价), 更新的规则: 被更新的对象和更新方法都不一样.
下面是部分实例代码,最后一个是模拟的数据更新。
Java代码
public interface CommonDefn {
public static int HIGHLIGHT_BACKGROUND_COLOR_INDEX = 0xff0033ff;
public class DoThingsReturn{
public Object cmd;
public Object data;
public int errCode;
public DoThingsReturn(Object cmd, Object data, int errorCode) {
super();
this.cmd = cmd;
this.data = data;
this.errCode = errorCode;
}
}
}
public interface CommonDefn {
public static int HIGHLIGHT_BACKGROUND_COLOR_INDEX = 0xff0033ff;
public class DoThingsReturn{
public Object cmd;
public Object data;
public int errCode;
public DoThingsReturn(Object cmd, Object data, int errorCode) {
super();
this.cmd = cmd;
this.data = data;
this.errCode = errorCode;
}
}
}
Java代码
/**
* used for updating the background of the view while the data changed
*
*
*/
public interface RefreshHandlerInterface {
public void updateBackground(Object handlerId, int color); //the proxy updating method
public Handler getHandler(); //the proxy handler
}
/**
* used for updating the background of the view while the data changed
*
*
*/
public interface RefreshHandlerInterface {
public void updateBackground(Object handlerId, int color); //the proxy updating method
public Handler getHandler(); //the proxy handler
}
Java代码
/**
*
* decrease alpha channel value from 255 to 0.
点击下载:源码下载
更多精彩
赞助商链接