Reputation: 76
I am starting to learn Android Development and I had a question about multiple choice lists. I have a list in my layout with about 20 items with an ArrayAdapter wrapped around a string array. When I try to use myList.getCheckedItemPositions()
with all the 20 items, it returns a null pointer but when I reduce the number of items to 6, I am able to find which items are checked and display them too (in other words, it works as expected).
I have a subclass that implements the AdapterView.OnItemClickListener
interface and I have supplied an instance of the class to myList.SetOnIntemClickListener()
. In the subclass, I have the implemented method, onItemClick()
where I call myList.getCheckedItemPositions()
and iterate through the checked items to display them.
When I tried debugging the application, the ListView only had 12 children, the last 5 being null, which meant that only 7 of the 20-some items that the ArrayAdapter was supplying were being "read". Please help me figure out what I am doing wrong in this, do I have to use a different listener for a multiple choice list? Also the ListView is displayed in a way that only the first 5 items from the list are displayed, would that have anything to do with this?
Thanks
Upvotes: 1
Views: 742