Karthik
Karthik

Reputation: 5033

How to get to know whether the checkbox is checked or not in a multiple choice listview in android?

I am using multiple choice listview,in this I would am getting the position values when clicked on it.how to know whether it is checked or not.Kindly help me on this.Thanks.

Upvotes: 1

Views: 368

Answers (2)

Geralt_Encore
Geralt_Encore

Reputation: 3771

Use Array boolean[] selected, where you save checkboxes state.

In your OnItemSelected method use this:

selected[position] = true or false

Upvotes: 0

colegu
colegu

Reputation: 370

set:

listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);

and check if a particular view from the listView is checked with:

listView.isItemChecked(i) //i is the position of the view.

Upvotes: 3

Related Questions