CymChad / CymChad/BaseRecyclerViewAdapterHelper

使用ConcatAdapter时,设置的itemType无效报错

Open
#3,479 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
24.6k
Forks
5.2k
PR merge metrics
No merged PRs in 30d

Description

使用ConcatAdapter包裹两个这个adapter时,在显示时,拿到的itemType并不是设置的值,导致找不到provider,报空指针错误
Process: com.donkingliang.consecutivescroller, PID: 13316
kotlin.KotlinNullPointerException
at com.chad.library.adapter.base.BaseProviderMultiAdapter.convert(BaseProviderMultiAdapter.kt:57)
at com.chad.library.adapter.base.BaseQuickAdapter.onBindViewHolder(BaseQuickAdapter.kt:376)
at com.chad.library.adapter.base.BaseQuickAdapter.onBindViewHolder(BaseQuickAdapter.kt:382)
at com.chad.library.adapter.base.BaseQuickAdapter.onBindViewHolder(BaseQuickAdapter.kt:75)
at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7258)
at androidx.recyclerview.widget.NestedAdapterWrapper.onBindViewHolder(NestedAdapterWrapper.java:157)
at androidx.recyclerview.widget.ConcatAdapterController.onBindViewHolder(ConcatAdapterController.java:368)
at androidx.recyclerview.widget.ConcatAdapter.onBindViewHolder(ConcatAdapter.java:188)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with two adapters wrapped in AndroidX ConcatAdapter, then inspect BaseProviderMultiAdapter.convert and the BaseQuickAdapter.onBindViewHolder paths named in the stack trace. Done means the configured itemType is preserved during binding, the correct provider is found, and the null-pointer failure no longer occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.