摘要: 今天看Launcher的源代码的时候,看到有个叫original-package,有个哥们已经写过相关的博客,原封不动copy过来。只用于安装在system image的packages。需要注意下这里package="com.android.launcher",产生的R.java就会在com.android.launcher中 这个地方表示,源码包是com.android.launcher2。所以在代码中引用的R.java必须是import com.android.launcher.R;其实很简单,随便写了个测试程序,很容易搞明白。使用标签的话, 等组件在标识" 阅读全文
posted @ 2012-06-18 15:32 誑逩の蝸犇 阅读(247) 评论(0) 推荐(0) 编辑
摘要: 迪米特法则(Law of Demeter LoD) –>最少只是原则(Least Knowledge Principle,LKP) 一个对象应该对其它的对象有最少的了解 阅读全文
posted @ 2012-06-05 15:25 誑逩の蝸犇 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 开放关闭原则(Open Close Principle OCP)Software entities like classes,modules and functions should be open for extension but closed for modifications.一个软件实体如类、模块和函数应该对扩展开放,对修改关闭。 阅读全文
posted @ 2012-06-05 14:50 誑逩の蝸犇 阅读(332) 评论(0) 推荐(0) 编辑
摘要: 接口隔离原则Interface Segregation PrincipleClients should not be forced to depend upon interfaces that they don’t use客户端不应该依赖它不需要的接口The dependency of one class to another one should depend on the smallest possible interface类间的依赖关系应该建立在最小的接口上 阅读全文
posted @ 2012-06-05 14:39 誑逩の蝸犇 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 依赖倒置原则(Dependence Inversion Principle) High level modules should not depend upon low level modules. Both should depend upon abstractions. Abstractions should not depend upon details.Details should depend upon abstractions. 高层模块不应该依赖低层模块,两者都应该依赖其抽象;抽象不应该依赖细节;细节应该依赖抽象 。 阅读全文
posted @ 2012-06-05 11:19 誑逩の蝸犇 阅读(354) 评论(0) 推荐(0) 编辑
摘要: 里氏替换原则 If for each object o1 of type S there is an object o2 of type T such that for all programs P defined in terms of T, the behavior of P is unchanged where o1 is substituted for o2 then S is a subtype of T。(Functions that use pointers or references to base classes must be able to use object of d 阅读全文
posted @ 2012-06-05 10:33 誑逩の蝸犇 阅读(1504) 评论(0) 推荐(0) 编辑
摘要: Single Responsibility Principle应该有且只有一个原因引起类的变更 阅读全文
posted @ 2012-06-05 10:18 誑逩の蝸犇 阅读(245) 评论(0) 推荐(0) 编辑
摘要: ThreadLocal即线程局部变量。功能:为每个使用该变量的线程,提供一个该变量的副本。其实ThreadLocal中拥有一个Map,它是线程->变量的映射。主要方法有三个,set,get,initValue。set与get的作用不用多讲,主要是initValue,它默认返回的是null,子类可以通过重载该方法,来改变默认值。1publicvoidset(Tvalue){2Threadt=Thread.currentThread();3ThreadLocalMapmap=getMap(t);4if(map!=null)5map.set(this,value);6else7createMa 阅读全文
posted @ 2012-06-05 09:26 誑逩の蝸犇 阅读(396) 评论(0) 推荐(0) 编辑
摘要: android:configChanges="keyboardHidden|orientation|screenSize" 阅读全文
posted @ 2012-06-01 13:38 誑逩の蝸犇 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 1.创建 、打开注册表LONG RegQueryValueEx( HKEY hKey, // handle to key LPCTSTR lpValueName, // value name LPDWORD lpReserved, // reserved LPDWORD lpType, // type buffer LPBYTE lpData, // data buffer LPDWORD lpcbData // size of data buffer ); 说明 获取一个项的设置值 返回值 Long,零(ERROR_SUCCESS)表示成功。其他任... 阅读全文
posted @ 2012-05-15 22:38 誑逩の蝸犇 阅读(1127) 评论(0) 推荐(0) 编辑