I'm trying to use reflection (on an android app) to invoke a method and it work only when I do it this way
Object impresora = loadedClass.newInstance();
Object args[] = {"00:15:0E:E0:DD:38", true};
for(Method m : impresora.getClass().getDeclaredMethods())
if("BTConnection".compareTo(m.getName()) == 0)
int resultado = (Integer) m.invoke(impresora, args);
But I don't want to iterate everytime, so I'm trying this way, but this is where I get the NoSuchMethodException
Method m = impresora.getClass().getDeclaredMethod("BTConnection");
m.invoke(impresora, args);
Thanks in advance