-1

I have created a similar question already, but I have a problem:

String lv_arr[] = new String[key];
ArrayAdapter<String> adapterlist = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, lv_arr);

listView1.setTextFilterEnabled(true);
listView1.setAdapter(adapterlist);

adapterlist.notifyDataSetChanged();
adapterlist.remove(adapterlist.getItem(0));
adapterlist.notifyDataSetChanged();

The item in ListView does't get removed using the code below. I looked for a solution for days.

adapterlist.remove(String object);
Community
  • 1
  • 1
user1468102
  • 391
  • 5
  • 16

1 Answers1

0

Try to remove the objects from your collection and then call adapterlist.notifyDataSetChanged() to reload the collection.

lv_arr.removeAt(0);
adapterlist.notifyDataSetChanged();
Stelian Matei
  • 11,553
  • 2
  • 25
  • 29