public Method getDeclaredMethod(String name, Class<?>... parameterTypes) throws NoSuchMethodException, SecurityException
public Method getMethod(String name, Class<?>... parameterTypes) throws NoSuchMethodException, SecurityException
public void printInfo(String str, int iNum, double dNum, long i);
getMethod("printInfo", String.class, int.class, double.class, long.class);
public Object invoke(Object obj, Object... args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
package android.os;
import java.util.ArrayList;
import android.util.Log;
/**
* Gives access to the system properties store. The system properties
* store contains a list of string key-value pairs.
*
* {@hide}
*/
public class SystemProperties
{
// 省略具体实现代码
/**
* Get the value for the given key.
* @return an empty string if the key isn't found
* @throws IllegalArgumentException if the key exceeds 32 characters
*/
public static String get(String key) {
if (key.length() > PROP_NAME_MAX) {
throw new IllegalArgumentException("key.length > " + PROP_NAME_MAX);
}
return native_get(key);
}
}
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import android.util.Log;
public class SystemProperties {
public static String get(String key) {
String value = "";
Class<?> cls = null;
try {
cls = Class.forName("android.os.SystemProperties");
Method hideMethod = cls.getMethod("get", String.class);
Object object = cls.newInstance();
value = (String) hideMethod.invoke(object, key);
} catch (ClassNotFoundException e) {
Log.e("zhengyi.wzy", "get error() ", e);
} catch (NoSuchMethodException e) {
Log.e("zhengyi.wzy", "get error() ", e);
} catch (InstantiationException e) {
Log.e("zhengyi.wzy", "get error() ", e);
} catch (IllegalAccessException e) {
Log.e("zhengyi.wzy", "get error() ", e);
} catch (IllegalArgumentException e) {
Log.e("zhengyi.wzy", "get error() ", e);
} catch (InvocationTargetException e) {
Log.e("zhengyi.wzy", "get error() ", e);
}
return value;
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有