android 属性系统使用的小问题
16lz
2021-01-24
http://blog.csdn.net/njhao/archive/2010/10/11/5932635.aspx
原理说明:http://www.williamhua.com/2010/03/05/android-property-system/
注意点
- System.getProperty只能访问process自有的property
- 如需访问System Property,需要利用反射机制调用SystemProperty.get
- publicstaticintgetInt(Stringkey,intdef){
- try
- {
- //thisfieldisnotavailableinAndroidSDK
- if(getIntMethod==null)
- {
- getIntMethod=Class.forName("android.os.SystemProperties").getMethod("getInt",newClass[]{String.class,int.class});
- }
- return(Integer)getIntMethod.invoke(null,newObject[]{key,def});
- }catch(Exceptione)
- {
- thrownewRuntimeException("Platformerror",e);
- }
- //returndef;
- }
更多相关文章
- android中的 Handler机制
- [Android]判断是否是华为EMUI系统
- Android(安卓)wifi设计原理(源码分析)
- Android面试题总结(七)原理篇
- Android(安卓)列表按照时间排序
- Android(安卓)binder 原理及实现机制
- android消息机制(handler运行机制)解析
- android进行异步更新UI的四种方式
- Gallery的使用