1

I am using java reflection to call a method "execute" on a runtime-determined class object, which extends AsyncTask

Class[] parameterTypes = new Class[] {Class.forName("java.lang.Object")};           
// ObjAT is the runtime-determined AsyncTask object. 
Method method = objAT.getClass().getMethod("execute", parameterTypes);

Class.forName("java.lang.Object") is not the correct type of Param. Can anyone tell me what type of Param is, i.e. what should I use in Class.forName("") instead of "java.lang.Object"

Because I'm calling AsyncTask->execute(Param...);

MapleLover
  • 665
  • 5
  • 7

1 Answers1

2

From what I understand here and here, you should try code like this:

// ObjAT is the runtime-determined AsyncTask object.
Method method = objAT.getClass().getMethod("execute", Object[].class);
Community
  • 1
  • 1
antonv
  • 1,227
  • 13
  • 21