This is possibly a strange question, and I understand if there will be downvotes here
So, I have a custom adapter (using the ViewHolder template) that looks like this:
private class ViewHolder {
ImageView chatImage;
TextView chatName;
TextView lastMessage;
TextView lastMessageTime;
TextView unreadMessagesCount;
//ViewStub avatarsViewStub;
}
private ViewHolder createViewHolder (View view) {
ViewHolder holder = new ViewHolder();
holder.chatImage = (ImageView) view.findViewById(R.id.chat_image);
holder.chatName = (TextView) view.findViewById(R.id.chat_participant_name);
holder.lastMessage = (TextView) view.findViewById(R.id.last_message);
holder.lastMessageTime = (TextView) view.findViewById(R.id.last_message_time);
holder.unreadMessagesCount = (TextView) view.findViewById(R.id.unread_messages_count);
return holder;
}
TextView unreadMessagesCountshould show the number of unread messages, and whenever a new message arrives, it should be updated. But, as you can see, there is a lot Views, and my goal is here: Update only unreadMessagesCount instead of calling integers getViewwhen adapter.notifyDataSetChanges()called , I want to know if this is possible
Edit : I posted my current solution as one of the answers, but we are still looking for a more suitable approach