Android examples for java.lang.reflect:Method
check if class has Declared Method
//package com.java2s; import java.lang.reflect.Method; import android.util.Log; public class Main { public static final String TAG = "ReflectionHelper"; public static boolean hasDeclaredMethod(Class<?> c, String methodName) { try {//ww w . j a va 2 s . c om for (Method m : c.getDeclaredMethods()) if (m.getName().equals(methodName)) return true; } catch (Exception ex) { Log.e(TAG, ex.toString()); } return false; } }