Skip to content

Instantly share code, notes, and snippets.

@devrath
Created August 20, 2015 13:25
Show Gist options
  • Select an option

  • Save devrath/c77827e602f0b5123cd4 to your computer and use it in GitHub Desktop.

Select an option

Save devrath/c77827e602f0b5123cd4 to your computer and use it in GitHub Desktop.
Used to remove, add and clear the items in listview. all methods to be placed in adapter and accessed from activity
public void removeAt(int position) {
items.remove(position);
notifyItemRemoved(position);
notifyItemRangeChanged(position, items.size());
}
public void clearAll() {
items.clear();
notifyDataSetChanged();
}
public void addItem(Object itemss) {
items.add(itemss);
notifyItemInserted(items.size());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment