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
- public static int getInt(String key, int def) {
- try
- {
- // this field is not available in Android SDK
- if(getIntMethod == null)
- {
- getIntMethod = Class.forName("android.os.SystemProperties").getMethod("getInt", new Class[] {String.class, int.class});
- }
- return (Integer) getIntMethod.invoke(null, new Object[] {key, def});
- } catch(Exception e)
- {
- throw new RuntimeException("Platform error", e);
- }
- // return def;
- }