Administrator
2021-11-06 a824b62bde75373c9b6b8d3a60b3a279895c8675
app/src/main/java/com/duqing/missions/base/adapter/BaseAdapter.java
@@ -12,6 +12,7 @@
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;
@@ -64,6 +65,17 @@
                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();
            }