Set of ListView SelectionIndex before loading of elements is complete
@@ -183,6 +183,7 @@ public class ListAdapterWithRecyclerView
public void toggleSelection(int pos) {
// With single select, clicked item becomes the only selected item
+ // Using 0-indexed array.
Arrays.fill(selection, Boolean.FALSE);
for (int i = 0; i < itemViews.length; i++) {
// Views are created when they are displayed, so this list may not be fully populated.
@@ -192,9 +193,11 @@ public class ListAdapterWithRecyclerView
}
if (pos >= 0) {
selection[pos] = true;
+ if (itemViews[pos] != null) {
itemViews[pos].setBackgroundColor(selectionColor);
}
}
+ }
public void changeSelections(int pos) {
// With multi select, clicking an item toggles its selection status on and off
