Android examples for java.lang.reflect:Method Invoke
invoke Reflect Function on Object and method name
//package com.java2s; import java.lang.reflect.Method; public class Main { public static Object invokeReflectFunction(Object obj, String method) { try {/*ww w.j a v a 2 s .c o m*/ Method m = null; try { m = obj.getClass().getDeclaredMethod(method); } catch (Exception e) { m = obj.getClass().getMethod(method); } m.setAccessible(true); return m.invoke(obj); } catch (Exception e) { } return null; } }