isMethodExists

Check whether a method exists within its class. An example for this method is:

boolean methodExists = InternalAccessor.isMethodExists("android.content.Intent", "putExtra", String.class, Integer.class);
if (methodExists)
{
    ...
}
where putExtra() has two types of parameter, i.e. String and Integer. If you look at the source code, you'll see that the real method is: putExtra(String name, int value).

See isMethodExists

Return

true if the method exists, false otherwise or the class could not be found

Parameters

className

class name with its package, e.g. android.content.Intent

methodName

method name within its class, e.g. putExtra

parameterTypes

class of the method's parameter type, e.g. for putExtra(String name, int value), you should type String.class, Integer.class

open fun isMethodExists(className: String, methodName: String, parameterTypes: Array<Class<Out Any>>): Boolean

Check whether a method exists without checking its parameter types. This is similar with

Return

true if the method exists, false otherwise or the class could not be found

Parameters

className

class name with its package, e.g. android.content.Intent

methodName

method name within its class, e.g. putExtra

open fun isMethodExists(className: String, methodName: String): Boolean