summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/app/SearchDialog.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java
index 9c20a4bbba7f..b75bec2dc8eb 100644
--- a/core/java/android/app/SearchDialog.java
+++ b/core/java/android/app/SearchDialog.java
@@ -67,6 +67,7 @@ import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
+import android.widget.ListAdapter;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemSelectedListener;
@@ -1750,7 +1751,7 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS
// case we want to dismiss the soft keyboard so the user can see the rest of the
// shortcuts.
if (isInputMethodNotNeeded() ||
- (isEmpty() && getDropDownChildCount() >= getAdapter().getCount())) {
+ (isEmpty() && getDropDownChildCount() >= getAdapterCount())) {
mSearchDialog.cancel();
return true;
}
@@ -1758,6 +1759,11 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS
}
return false;
}
+
+ private int getAdapterCount() {
+ final ListAdapter adapter = getAdapter();
+ return adapter == null ? 0 : adapter.getCount();
+ }
}
protected boolean handleBackKey(int keyCode, KeyEvent event) {