Fixed a regression setting ListView selection mode without an adapter

This commit is contained in:
Adam Powell
2010-03-05 19:51:59 -08:00
parent f8012af8d3
commit cb704cd1e0

View File

@@ -455,6 +455,12 @@ public class ListView extends AbsListView {
checkSelectionChanged();
}
if (mChoiceMode != CHOICE_MODE_NONE &&
mAdapter.hasStableIds() &&
mCheckedIdStates == null) {
mCheckedIdStates = new LongSparseArray<Boolean>();
}
} else {
mAreAllItemsSelectable = true;
checkFocus();
@@ -3320,7 +3326,7 @@ public class ListView extends AbsListView {
if (mCheckStates == null) {
mCheckStates = new SparseBooleanArray();
}
if (mCheckedIdStates == null && mAdapter.hasStableIds()) {
if (mCheckedIdStates == null && mAdapter != null && mAdapter.hasStableIds()) {
mCheckedIdStates = new LongSparseArray<Boolean>();
}
}