-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 .

3
  • you want to remove a list view item that has been checked? Commented Dec 6, 2013 at 12:30
  • check this stackoverflow.com/questions/6834615/… Commented Dec 6, 2013 at 12:31
  • i will post the code Mr.Denis vasilenko on 10/12/2013 morning Commented Dec 9, 2013 at 13:28

1 Answer 1

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();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.