CymChad / CymChad/BaseRecyclerViewAdapterHelper
BaseBinderAdapter 第一次打开fragment没事,第二次进入后报错,ClassCastException: xxx.bean.ImageUrlBean cannot be cast to xxx.bean.FictionBean
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 24.6k
- Forks
- 5.2k
- PR merge metrics
- No merged PRs in 30d
Description
private BaseBinderAdapter adapter = new BaseBinderAdapter();
adapter.addItemBinder(ImageUrlBean.class, new ImageItemBinder())
.addItemBinder(VideoBean.class, new VideoItemBinder())
.addItemBinder(FictionBean.class, new ContentItemBinder());
List data = new ArrayList<>();
data.add(new ImageUrlBean("https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=119713024,2807881900&fm=26&gp=0.jpg"));
data.add(new VideoBean("捌佰", "是一部抗日战争神剧来的" + random.nextInt(5) + 10));
data.add(new FictionBean("星辰变", "辰东写的小说"));
adapter.setList(data);
异常:ClassCastException: xxx.bean.ImageUrlBean cannot be cast to xxx.bean.FictionBean
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported sequence with BaseBinderAdapter: open the fragment once, leave it, and enter it again with the ImageUrlBean, VideoBean, and FictionBean list. Inspect how the adapter retains its item-binder mapping and data between entries. Done means the second entry completes without a ClassCastException and each bean is handled by its corresponding binder.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100