Skip to content

Commit 158c190

Browse files
committed
Fix logic inversion in ListView Javadoc
The Javadoc for isItemChecked, getCheckedItemPosition, and getCheckedItemPositions stated the return was valid if conditions were the inverse of what the method checked for. This was pointed out in Android issue 2366
1 parent 9b90fd4 commit 158c190

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

core/java/android/widget/ListView.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3167,11 +3167,12 @@ public void setItemChecked(int position, boolean value) {
31673167

31683168
/**
31693169
* Returns the checked state of the specified position. The result is only
3170-
* valid if the choice mode has not been set to {@link #CHOICE_MODE_SINGLE}
3170+
* valid if the choice mode has been set to {@link #CHOICE_MODE_SINGLE}
31713171
* or {@link #CHOICE_MODE_MULTIPLE}.
31723172
*
31733173
* @param position The item whose checked state to return
3174-
* @return The item's checked state
3174+
* @return The item's checked state or <code>false</code> if choice mode
3175+
* is invalid
31753176
*
31763177
* @see #setChoiceMode(int)
31773178
*/
@@ -3185,7 +3186,7 @@ public boolean isItemChecked(int position) {
31853186

31863187
/**
31873188
* Returns the currently checked item. The result is only valid if the choice
3188-
* mode has not been set to {@link #CHOICE_MODE_SINGLE}.
3189+
* mode has been set to {@link #CHOICE_MODE_SINGLE}.
31893190
*
31903191
* @return The position of the currently checked item or
31913192
* {@link #INVALID_POSITION} if nothing is selected
@@ -3202,10 +3203,12 @@ public int getCheckedItemPosition() {
32023203

32033204
/**
32043205
* Returns the set of checked items in the list. The result is only valid if
3205-
* the choice mode has not been set to {@link #CHOICE_MODE_SINGLE}.
3206+
* the choice mode has not been set to {@link #CHOICE_MODE_NONE}.
32063207
*
32073208
* @return A SparseBooleanArray which will return true for each call to
3208-
* get(int position) where position is a position in the list.
3209+
* get(int position) where position is a position in the list,
3210+
* or <code>null</code> if the choice mode is set to
3211+
* {@link #CHOICE_MODE_NONE}.
32093212
*/
32103213
public SparseBooleanArray getCheckedItemPositions() {
32113214
if (mChoiceMode != CHOICE_MODE_NONE) {

0 commit comments

Comments
 (0)