| | |
| | | import com.duqing.missions.databinding.LayoutNullBinding; |
| | | import com.duqing.missions.util.DeviceUtil; |
| | | |
| | | import java.lang.reflect.InvocationTargetException; |
| | | import java.lang.reflect.Method; |
| | | import java.lang.reflect.ParameterizedType; |
| | | import java.util.ArrayList; |
| | |
| | | Method method = entityClass.getMethod("inflate", LayoutInflater.class,ViewGroup.class,boolean.class);//get method from name "inflate"; |
| | | B vBind = (B) method.invoke(entityClass,LayoutInflater.from(parent.getContext()),parent,false);//execute method to create a objct of viewbind; |
| | | return new ViewBindHolder(vBind); |
| | | } catch (SecurityException e) { |
| | | e.printStackTrace(); |
| | | } catch (NoSuchMethodException e) { |
| | | e.printStackTrace(); |
| | | } catch (IllegalArgumentException e) { |
| | | e.printStackTrace(); |
| | | } catch (IllegalAccessException e) { |
| | | e.printStackTrace(); |
| | | } catch (InvocationTargetException e) { |
| | | Throwable t = e.getTargetException();// 获取目标异常 |
| | | t.printStackTrace(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |