In my List
I'd like to remove an item: v
is the button I clicked on. I tagged the position with holder.button1.setTag(position);
Then, in the GetView's ClickListener :
Log.e("Tag", String.valueOf((Integer) v.getTag())); //returns 2
data.remove((Integer) v.getTag()); //Does not remove the item
data.remove(2); //Removes it !!!!
Where is my error ?
EDIT : Where
holder = new NewsHolder();
and
static class NewsHolder{
TextView itemName;
ImageView icon;
Button button1;
Button button2;
Button button3;
}
您是否尝试过使用int类型而不是Integer,后者是不同于int类型的对象?
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.