Java tutorial
//package com.java2s; //License from project: Open Source License import android.util.Log; import java.lang.reflect.Method; public class Main { private static boolean LOGENABLE = false; private static String getSystemProperty(String key, String defaultValue) { String value = defaultValue; try { Class<?> clazz = Class.forName("android.os.SystemProperties"); Method get = clazz.getMethod("get", String.class, String.class); value = (String) (get.invoke(clazz, key, "")); } catch (Exception e) { if (LOGENABLE) { Log.d("getSystemProperty", "key = " + key + ", error = " + e.getMessage()); } } if (LOGENABLE) { Log.d("getSystemProperty", key + " = " + value); } return value; } }