Android examples for java.lang.reflect:Method Invoke
invoke Boolean Method via reflection
//package com.java2s; import java.lang.reflect.Method; public class Main { static boolean invokeBooleanMethod(Object receiver, String className, String methodName, Object... args) { try {/*from w w w. j a va 2s .c o m*/ Method method = Class.forName(className).getDeclaredMethod( methodName); method.setAccessible(true); return (boolean) method.invoke(receiver, args); } catch (Throwable t) { t.printStackTrace(); } return false; } }