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
Best Answer:
You need to override getItemViewType() method in your adapter. Also you can check hereIf you have better answer, please add a comment about this, thank you!
Source: Stackoverflow.com