上一页 1 ··· 3 4 5 6 7 8 下一页
摘要: The Observer Pattern defines a one-to-many dependency between objects so that when oneobject changes state, all of its dependents are notified and updated automatically.The Observer Pattern defines a one-to-many relatioship between objects.Design PrincipleStrive for loosely coupled designs between o 阅读全文
posted @ 2012-04-25 11:33 qiangzhu 阅读(454) 评论(0) 推荐(0) 编辑
摘要: Design Principle:Identify the aspects of your application that vary and sparate them from what stays the same.Program to an interface, not an implementation.Favor composition over inheritanceThe Strategy Pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable.St 阅读全文
posted @ 2012-04-25 11:05 qiangzhu 阅读(362) 评论(0) 推荐(0) 编辑
摘要: 1.String,StringBuffer和StringBuilder区别String为immutable,StringBuffer为线程安全,StringBuilder非线程安全2.如何对一已知的List中的对象排序Collections.sort<List<T> list, Comparator<? super T> c>对象实现Comparator接口的compare(T o1, T o2)方法3.Java API中Arrays.sort(int[] a)排序算法是如何实现的if(len < 7){ //Insertion sort on sma 阅读全文
posted @ 2012-04-24 20:09 qiangzhu 阅读(192) 评论(0) 推荐(0) 编辑
摘要: The Facade Pattern provides a unified interface to a set of interfaces in a subsystem. Facade defines a higher-levelinterface that makes the subsystem easier to use.A facade not only simplifies an interface, it decouples a client from a subsystem of components.Facades and adapters may wrap multiple 阅读全文
posted @ 2012-04-24 16:35 qiangzhu 阅读(431) 评论(0) 推荐(0) 编辑
摘要: The Adapter Pattern converts the interface of a class into another interface the clients expect.Adapter lets classedwork togetherthat couldn't otherwise because of imcompatible interfaces.Object and class adaptersclass diagramThe only difference is that with class adapter we subclass the Target 阅读全文
posted @ 2012-04-24 16:01 qiangzhu 阅读(510) 评论(0) 推荐(0) 编辑
摘要: Command Pattern allows you to decouple the requester of an action from the object actually performs the action. A commandobject encapsulates a request to do something on a specific object.From dinner to the Command Pattern1.Implementing the Command interfacepublic interface Command{ public void exe. 阅读全文
posted @ 2012-04-18 17:52 qiangzhu 阅读(691) 评论(0) 推荐(0) 编辑
摘要: TelephonyManager tm = (TelephonyManager)Context.getSystemService(Context.TELEPHONY_SERVICE);注意:一些电话信息需要相应的权限。// 获取服务提供商名字,比如电信,联通,移动用下面的方法第一种方法: 获取手机的IMSI码,并判断是中国移动\中国联通\中国电信getSimOperatorName() //Returns the Service Provider Name (SPN).IMSI 国际移动用户识别码(IMSI:International Mobile Subscriber Identifica. 阅读全文
posted @ 2012-01-11 18:16 qiangzhu 阅读(30528) 评论(0) 推荐(0) 编辑
摘要: 最近遇到一个问题,在后一版本覆盖安装前一版本的时候,然后启动应用出现异常,归纳下原因有一.在后一版本中数据库有改变,比如字段类型,那么覆盖安装并没有删除点原来数据库中的数据,很明显,在后版本中就出现问题了二.在后一版本中得sharepreferences的数据有改变,那么也会出现问题,比如原来的sharepreferences保存的一数据是boolean,在后一版本把保存的数据改为了string,问题就出现了。那么在 content provider 和file保存数据的时候会不会也是这样的?没试过。那么如何解决?1.不允许覆盖安装,用户先要卸载老版本,然后才能安装新版本,卸载了老版本,跟老版 阅读全文
posted @ 2011-12-30 21:30 qiangzhu 阅读(13732) 评论(0) 推荐(0) 编辑
摘要: 图G(V,E)的表示两种标准方法邻接表邻接矩阵稀疏图:|E|远小于|V|2稠密图:|E|接近与|V|2 阅读全文
posted @ 2011-12-27 13:58 qiangzhu 阅读(170) 评论(0) 推荐(0) 编辑
摘要: 最近做一个功能,需要同步本地联系人信息,主要从SIM卡和android通信录得到SIM卡获取联系人,由于SIM卡容量有限,它只存储了联系人的名字和号码View Code 1 private static final int NAME_COLUMN = 0; 2 3 private static final int NUMBER_COLUMN = 1; 4 5 private static final String SURI = "content://icc/adn"; 6 7 private Context context... 阅读全文
posted @ 2011-12-22 17:02 qiangzhu 阅读(1927) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 下一页