• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: java.lang.ClassCastException: UserViewHolder cannot be cast to BotViewHolder

Resolved: java.lang.ClassCastException: UserViewHolder cannot be cast to BotViewHolder

0
By Isaac Tonny on 04/04/2023 Issue
Share
Facebook Twitter LinkedIn

In this post, we will see how to resolve java.lang.ClassCastException: UserViewHolder cannot be cast to BotViewHolder

Question:

i’m trying to implement brainshop AI API into my android studio application to output response from the chatbot to the user’s input or question but i am getting this java.lang.ClassCastException.
ERROR java.lang.ClassCastException: com.android.smartpoly.MessageRVAdapter$UserViewHolder cannot be cast to com.android.smartpoly.MessageRVAdapter$BotViewHolder
MainActivity.java
MessageRVAdapter.java
MsgModal.java
ChatModal.java
I am new to programming and hoping someone can help me fix it

Best Answer:

You need to override getItemViewType() method in your adapter. Also you can check here

If you have better answer, please add a comment about this, thank you!

Source: Stackoverflow.com

android android-recyclerview android-studio java
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: How to stop a thread that has a blocking function from easygui in python

05/04/2023

Resolved: Removing null keys from a json array of objects

05/04/2023

Resolved: How can I generate at compile-time a separate OpenAPI Swagger.json file for each Controller in my ASP.NET project?

05/04/2023

Comments are closed.

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.