I have an issue within my custom listview. Each row of the listview contains a button and a textview when the button is clicked a certain string is assigned to the textview. First , it worked like a charm then a strange issue occurs.
When I click the button of a specific row, the required string is assigned to the next textview (That's normal) but I noticed another textview in another row also has been assigned with the string.Thus, setext(string) has been assigned to two textviews in different rows with a single click.This is the code I use in my public getView
holder.bu6.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
holder.textViewNumber.setText(String.valueOf(counter[position]));
}
});
you can create your list with model getter setter.
public class Category {
private String category;
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public Category(String category) {
this.category = category;
}
}
now when you click on button then change string of that position in your list and notify your adapter.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.