From 3016c1ae6a05a67106301fc5ffd7779338288e65 Mon Sep 17 00:00:00 2001 From: Svetoslav Ganov Date: Mon, 4 Jun 2012 19:47:40 -0700 Subject: [PATCH] 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 --- core/java/android/widget/AbsListView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index 2d207ec486c8b..5f6073522381d 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -1388,7 +1388,7 @@ public abstract class AbsListView extends AdapterView 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;