android 属性系统使用的小问题

 http://blog.csdn.net/njhao/archive/2010/10/11/5932635.aspx

原理说明:http://www.williamhua.com/2010/03/05/android-property-system/

注意点

  1. System.getProperty只能访问process自有的property
  2. 如需访问System Property,需要利用反射机制调用SystemProperty.get
  1. public static int getInt(String key, int def) {  
  2.         try  
  3.         {  
  4.             // this field is not available in Android SDK  
  5.             if(getIntMethod == null)  
  6.             {  
  7.                 getIntMethod = Class.forName("android.os.SystemProperties").getMethod("getInt", new Class[] {String.class, int.class});  
  8.             }  
  9.             return (Integer) getIntMethod.invoke(null, new Object[] {key, def});  
  10.         } catch(Exception e)  
  11.         {  
  12.             throw new RuntimeException("Platform error", e);  
  13.         }                     
  14. //      return def;  
  15.     } 
原文地址:https://www.cnblogs.com/leaven/p/1948145.html