Android class.getMethod not working on Android 2.3 (Gingerbread)

166 Views Asked by At
final Method method = this.getClass().getMethod("sort", View.class);

throws a MethodNotFoundException only on Android 2.3 devices (higher Android versions return the method). This is what Android uses to handle xml onClicks, which means all of them are crashing in my app on 2.3 devices. However,

final Method method = this.getClass().getDeclaredMethod("sort", View.class);

Successfully returns the method.

Here is the method (which is in the same class as the above calls):

public void sort(final View v){
    //Stuff
}
0

There are 0 best solutions below