Android examples for java.lang.reflect:Constructor
get Constructor by its parameter type
//package com.java2s; import java.lang.reflect.Constructor; public class Main { public static Constructor<?> getConstructor(Class<?> targetClass, Class<?>... types) { if (targetClass == null || types == null) return null; try {/*from w w w . ja va2 s.co m*/ return targetClass.getConstructor(types); } catch (SecurityException e) { // ignore } catch (NoSuchMethodException e) { // ignore } return null; } }