-1

How to remove values from the list-view based on the checkbox selection in android .

currently i am using public View getView(final int position, View convertView,ViewGroup parent) {} to call the checkbox initializing and calling . can you pls help me to remove values from the listview

Please Help me I am struck here for the past three days .

Harshad Pansuriya
  • 20,189
  • 8
  • 67
  • 95
venkateswaran
  • 233
  • 2
  • 11

1 Answers1

0

Write a Check box OnClickListener like this

chksin.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {

  int count = this.mainListView.getAdapter().getCount();
    for (int i = 0; i < count; i++) {
        if (this.mainListView.isItemChecked(i)) {
            painItems.remove(i)
        }
    }

        }
});

Then refresh the adapter :

adapter.notifyDataSetChanged();
Nagaraja
  • 581
  • 1
  • 4
  • 12