Merge "Fixed a regression setting ListView selection mode without an adapter"

This commit is contained in:
Adam Powell
2010-03-05 19:57:09 -08:00
committed by Android (Google) Code Review

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>();
}
}