How to delete check box items from list

后端 未结 6 1228
花落未央
花落未央 2021-01-14 02:24

I have 50 list item in the list. Now i have checked 10 item, so how to this 10 checked item delete(remove) from the listview when I click delete button.

Here is My C

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-14 02:53

    I think you problem does not need any big amount of code.You need just a concept.Answer Given above is best way of doing that.

    I am assuming i got ids which are selected. now simply arrayList.remove(position);
    and call notifyDataSetChanged();
    

    As List view sub child(CheckBox) can use setOnCheckChangesListener in base Adapter class directly.Now you just have to keep track record of check checkbox and their corresponding position in ArrayList.Now when you click on delete btn then remove element from arraylist and call notifyDataSetChanged()

提交回复
热议问题