我会尽量简短:
我有三个必须互动的课程:
服务器收到一条消息,此消息将添加到特定联系人的聊天中,然后必须更新RecyclerView。
这是基本的Contact类代码:
public class Contact implements Serializable {
private String name;
private String ip;
//Here would be a variable that contains the chat strings
public Contact (String name, String ip){
this.name = name;
this.ip = ip;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
}
然后在选择特定用户时启动聊天活动,它包含我想要消息的RecyclerView。
我的问题是,如何制作存储在的邮件 特定对象的变量出现在列表中。
非常感谢你。
答案 0 :(得分:1)
您可以使用数据类而不是序列化
public class Data {
private String text;
private String uid;
private String tnviews;
private String numberlikes;
public Data(String text,String tnviews,String numberlikes,String uid) {
this.text = text;
this.tnviews = tnviews;
this.numberlikes = numberlikes;
this.uid = uid;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
/////////// VIEWS
public String getViews() {
return tnviews;
}
public void setViews(String tnviews) {
this.tnviews = tnviews;
}
//////// likes
public String getLikes() {
return numberlikes;
}
public void setLikes(String numberlikes) {
this.numberlikes = numberlikes;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
答案 1 :(得分:0)