summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-05-23 13:27:18 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-05-23 13:27:18 -0700
commitd9a874a4cb8e82ae64c1698bd71ced8d87bbc5cd (patch)
treee40c1062ef8adb9f5cd0d20ae0c141ac79d03235 /core
parent270e87f71abc2edf446dbec20c725c823e8c7f37 (diff)
parenta02903fbee6725563da4472bd120f844e9d5518c (diff)
downloadframeworks_base-d9a874a4cb8e82ae64c1698bd71ced8d87bbc5cd.zip
frameworks_base-d9a874a4cb8e82ae64c1698bd71ced8d87bbc5cd.tar.gz
frameworks_base-d9a874a4cb8e82ae64c1698bd71ced8d87bbc5cd.tar.bz2
Merge change 2397 into donut
* changes: Fixes NPE in ListViews with non-selectable items. This was caused by a weird initialization issue in ListView and AbsListView: a private final field instanciated in the declaration in ListView was used in AbsListView<init> via an overriden method and that field was somehow null at this time. This fix moves the instanciation at a later point.
Diffstat (limited to 'core')
-rw-r--r--core/java/android/widget/ListView.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java
index e96ab20..10d8f55 100644
--- a/core/java/android/widget/ListView.java
+++ b/core/java/android/widget/ListView.java
@@ -134,7 +134,7 @@ public class ListView extends AbsListView {
// used for temporary calculations.
private final Rect mTempRect = new Rect();
- private final Paint mDividerPaint = new Paint();
+ private Paint mDividerPaint;
// the single allocated result per list view; kinda cheesey but avoids
// allocating these thingies too often.
@@ -2824,6 +2824,9 @@ public class ListView extends AbsListView {
final boolean opaque = (color >>> 24) == 0xFF;
mIsCacheColorOpaque = opaque;
if (opaque) {
+ if (mDividerPaint == null) {
+ mDividerPaint = new Paint();
+ }
mDividerPaint.setColor(color);
}
super.setCacheColorHint(color);
@@ -2849,6 +2852,9 @@ public class ListView extends AbsListView {
final boolean areAllItemsSelectable = mAreAllItemsSelectable;
final ListAdapter adapter = mAdapter;
final boolean isOpaque = isOpaque();
+ if (isOpaque && mDividerPaint == null) {
+ mDividerPaint = new Paint();
+ }
final Paint paint = mDividerPaint;
if (!mStackFromBottom) {