我想更新和ArrayAdapter
a TextView
当用户点击+
或-
按钮时。我无法弄清楚如何在ArrayApapter
中更改个人资料。
这里是为了更好地解释图像是我想做的事:如何在Android中单独更新ArrayAdapter数据
public View getView(int position, View countView, ViewGroup parent) {
View listView = countView;
if (listView == null) {
listView = LayoutInflater.from(getContext()).inflate(R.layout.listview, parent, false);
}
word currentWord = getItem(position);
TextView foodName = (TextView) listView.findViewById(R.id.food);
Button minus = (Button) listView.findViewById(R.id.minus);
Button add = (Button) listView.findViewById(R.id.add);
TextView total = (TextView) listView.findViewById(R.id.total);
add.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
minus.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
return listView;
}
尝试此链接http://stackoverflow.com/questions/3724874/how-can-i-update-a-single-row-in-a-listview –