Say I have a method that I wish to call which has an argument of a string
To call, I would do something like this.. myFunction(stringValue);
NOW, how would i make that same call, but dynamically if I had a string with the value of 'myFunction'..
something like
method = [convert "myFunction" string to method];
method.invoke(stringValue);
I am currently trying something like
java.lang.reflect.Method method;
method = Class.forName("com.blah.MyActivity").getMethod('myFunction',String.class);
method.invoke (stringValue);
but getting the error IllegalArgumentException Message expected receiver of type com.blah.MyActivity, but got java.lang.String
method.invoke( instance, stringValue )