public class SpinnerItemAdapter<T extends BaseSpinnerItem>
extends BaseAdapter
implements ISpinnerItemAdapter<T> {
private List<T> _baseSpinnerItemList;
public List<T> getSpinnerItems() {
return _baseSpinnerItemList;
}
}
SpinnerItemAdapter.class.getMethod("getSpinnerItems", new Class[] {}) // ok
.invoke(new SpinnerItemAdapter<BaseSpinnerItem>(),null) // throws bellow exception
Method threw 'java.lang.IllegalArgumentException' exception.
why fails ?
edit in reply:
** isn't the invoke suppose to be... (INSTANCE OF THAT CLASS, ANY PAREMETERS) – 3kings
/**
* @param receiver
* the object on which to call this method (or null for static methods)
* @param args
* the arguments to the method
* @return the result
*
* @throws NullPointerException
* if {@code receiver == null} for a non-static method
* @throws IllegalAccessException
* if this method is not accessible (see {@link AccessibleObject})
* @throws IllegalArgumentException
* if the number of arguments doesn't match the number of parameters, the receiver
* is incompatible with the declaring class, or an argument could not be unboxed
* or converted by a widening conversion to the corresponding parameter type
* @throws InvocationTargetException
* if an exception was thrown by the invoked method
*/
public native Object invoke(Object receiver, Object... args)
throws IllegalAccessException, IllegalArgumentException, InvocationTargetException;
Aucun commentaire:
Enregistrer un commentaire