Skip to content Skip to sidebar Skip to footer

IndexOutOfBoundsException When Removing A ListView Item With Delay

I created an adapter with items that contains remove buttons. When the user click the button the item should be removed. If I use this code: list.remove(item); notifyDataSetChang

Solution 1:

you need to update the count as well notifydatasetchange calls only getview method only so i suggest anyhow try to update the count as well,you are getting this exception because getCount method is not being called


Solution 2:

Try to replace this line:

holder.remove.setTag( item );

With this:

holder.remove.setTag(i);

You also put this line:

holder.remove.setOnClickListener( removeClick ); outside if else code

Post a Comment for "IndexOutOfBoundsException When Removing A ListView Item With Delay"