racofix / architecture-for-android

🙈 Coroutines + flow + mvvm-clean / mvp
881 stars 239 forks source link

关于RecyclerAdapter的setListener方法可能有错 #17

Closed l0n9er closed 6 years ago

l0n9er commented 6 years ago
              if (mOnItemClickListener != null) {
                    int position = getPosition(viewHolder);
                    mOnItemClickListener.onItemClick(parent, v, mDatas.get(position), position);
                }
`

position是从0开始, int position = getPosition(viewHolder);应该要减一 否则会报IndexOutOfBoundsException越界错误