NullPointerException in AbsListView.focusSearch().

1. One of the loops was using the last visible position
   as its end boundary as opposed to the child count
   minus one.

bug:6610451

Change-Id: I600545ca3f64d1e982f909f893e5d34570ec5c8b
This commit is contained in:
Svetoslav Ganov
2012-06-04 19:47:40 -07:00
parent a3404be930
commit 3016c1ae6a

View File

@@ -1388,7 +1388,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
}
// Try to move focus to the next item.
final int nextPosition = currentPosition - getFirstVisiblePosition() + 1;
for (int i = nextPosition; i <= getLastVisiblePosition(); i++) {
for (int i = nextPosition; i < getChildCount(); i++) {
View child = getChildAt(i);
if (child.getVisibility() == View.VISIBLE) {
return child;