am 4e1afc1a: Merge change 2361 into donut

Merge commit '4e1afc1a569d05cc6a1ee213c65ffb49513600ca'

* commit '4e1afc1a569d05cc6a1ee213c65ffb49513600ca':
  Fixes #1872506. Prevents NPE in ListView. When the opaque property changes at runtime, it is possible to end up in a situation in which the divider's Paint instance has not been instanciated. This change simples uses a final Paint that is guaranteed to not be null.
This commit is contained in:
Android (Google) Code Review
2009-05-22 14:51:25 -07:00
committed by The Android Open Source Project

View File

@@ -134,7 +134,7 @@ public class ListView extends AbsListView {
// used for temporary calculations.
private final Rect mTempRect = new Rect();
private Paint mDividerPaint;
private final Paint mDividerPaint = new Paint();
// the single allocated result per list view; kinda cheesey but avoids
// allocating these thingies too often.
@@ -2824,9 +2824,6 @@ 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);