문제

So im using the commonsware example of sectioned listviews,here, but i use the multiselection option. The problem is when i get the getCheckedItemPositions(), if i have selected from the second section or above the positions dont really match. Seems that the Section Headers count as a position, so im having a problem of getting the checked items from the second,third...sections.....

도움이 되었습니까?

해결책

ListView is the one keeping track of checked states, not the ListAdapter. Even the MergeAdapter does not really know what are headers and what are not -- they're all just contents to it.

You could extend (or replace) MergeAdapter with something that knew concretely the difference between headers and detail rows. That adapter could give you a method to convert an absolute position (what ListView reports in getCheckedItemPositions()) into a section and position within that section.

Also, for support on the CommonsWare books, open source code, and such, I recommend the cw-android Google Group.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top