比如你使用了图片工具glide.jar,
//android代码中是这样写 Glide.with(c).load("http://img.hb.aicdn.com/c04769d0e58521d0526febfc49b38847fdec06818965-O1Z2HK_fw658").into(iv);//iv是显示图片的控件//使用反射 Method method1;
String methodName1 = "load";//load 为隐藏类的隐藏method
Method method2;
String methodName2="into";
try {
method1 = Class.forName("com.bumptech.glide.Glide").getMethod(methodName1, String.class);
try {
method1.invoke(Class.forName("com.bumptech.glide.Glide"),"http://img.hb.aicdn.com/c04769d0e58521d0526febfc49b38847fdec06818965-O1Z2HK_fw658");
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
try {
method2 = Class.forName("com.bumptech.glide.Glide").getMethod(methodName2, String.class);
try {
method2.invoke(Class.forName("com.bumptech.glide.Glide"),iv);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
358



被折叠的 条评论
为什么被折叠?



