Android 为什么在适配器中设置空文本?

Android 为什么在适配器中设置空文本?,android,adapter,Android,Adapter,我对这个问题感到困惑 我在adapter中将文本设置为TextView,但当生成我的listview时,TextView仍然为空 我的问题是关于MyAdapter,因为当我手动放置文本时,它工作得非常好 请帮帮我 这是我的“适配器”: 您总是访问一个新的对象实例,而不是数组中的一项。请更换 item = new items(); 与 尝试删除item=newitems()行。它为适配器中的每个对象创建一个空对象。将其更改为item=feedItems.get(位置)谢谢你的回答,什么是fe

我对这个问题感到困惑

我在adapter中将文本设置为
TextView
,但当生成我的listview时,TextView仍然为空

我的问题是关于
MyAdapter
,因为当我手动放置文本时,它工作得非常好

请帮帮我

这是我的“适配器”


您总是访问一个新的对象实例,而不是数组中的一项。请更换

 item = new items(); 


尝试删除
item=newitems()行。它为适配器中的每个对象创建一个空对象。将其更改为
item=feedItems.get(位置)谢谢你的回答,什么是feedPositions?你认为这个
item=newitems()是什么是吗?@GamesroomIran我对答案进行了编辑。它应该是
feedItems
,在AdapterHa中存储所有项对象的数组,它可以工作,但每个项中的所有文本现在都是“项5”!哦,这是我的错误,谢谢你完美的回答。很高兴能帮上忙。
public class items {
private int id;
private String name, status, image, profilePic, timeStamp, url;

public items() {
}

public items(int id, String name, String image, String status,
                String profilePic, String timeStamp, String url) {
    super();
    this.id = id;
    this.name = name;
    this.image = image;
    this.status = status;
    this.profilePic = profilePic;
    this.timeStamp = timeStamp;
    this.url = url;
}

public int getId() {
    return id;
}

public void setId(int id) {
    this.id = id;
}

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}


}
 item = new items(); 
 item = feedItems.get(position);