我正在开发一款Android聊天应用程序。当我调用我的API时,它会按用户ID对聊天列表进行排序。但我需要按消息ID序列化,因为我想先显示最后一条消息。以下是我的onBindViewHolder方法,其中我获取值。
public void onBindViewHolder(final MyAdapter_HomeViewHolder holder, final int position) {
holder.userNameTV.setText(data.get(position).getUserInfo().getFullName());
holder.msgBodyTV.setText(data.get(position).getBody());
holder.originator_iD.setText(data.get(position).getUserInfo().getId().toString());
//message ID. I need to serialize my recyclerView by this ID.biggest id should appear first.
holder.messageId.setText(data.get(position).getId().toString());
holder.owner_type_ET.setText("1");
holder.subject_ET.setText("Message");
}
如果您需要查看完整代码,请访问https://pastebin.com/Zxmq36Gn
//在此处对数据进行排序 this.data = data; this.rowLayout = rowLayout; this.context = context; }`
- swerly