I have a ListView and it should have four different types of items. I searched for it, found different solutions that this is possible and tried to do my stuff just like the other persons did. I've created different ViewHolders (one for each type). When the ListView appears for the first time everything is fine. But when I begin to scroll I get a classCastException. The reason is pretty obvious:
holder = (FeedViewHolder) convertView.getTag();
My adapter tries to get the ViewHolder by getting the tag from the convertView if it's not null. But this ViewHolder seems to be the ViewHolder of the previous item so it can't be casted.
I search StackOverflow and Google but all the examples seem to work as they use the same or pretty equal ViewHolders for their different items. But my Objects really differ from each other and need different ViewHolders. Can anyone help me to solve this?