From bbd31559f32f86a100904fe8a5bc37677b5ba441 Mon Sep 17 00:00:00 2001 From: Svetoslav Ganov Date: Mon, 11 Jun 2012 12:08:18 -0700 Subject: NPE when iterating by character and word in Launcher widgets. 1. The character and word iterators were use the application context to keep track of locale changes. However, for widgets the context from which the app context is obtained is custom created therefore the app context is null and the iterators code does not expect that. Now we are caching the locale and update it when the configuration changes. bug:6642281 Change-Id: I3fd201ab9e4efd79e3bdc8afd8ee644e4354a7fb --- core/java/android/view/View.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'core/java/android/view/View.java') diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index f005eeba151c..816b631bf987 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -6957,7 +6957,8 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal CharSequence text = getIterableTextForAccessibility(); if (text != null && text.length() > 0) { CharacterTextSegmentIterator iterator = - CharacterTextSegmentIterator.getInstance(mContext); + CharacterTextSegmentIterator.getInstance( + mContext.getResources().getConfiguration().locale); iterator.initialize(text.toString()); return iterator; } @@ -6966,7 +6967,8 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal CharSequence text = getIterableTextForAccessibility(); if (text != null && text.length() > 0) { WordTextSegmentIterator iterator = - WordTextSegmentIterator.getInstance(mContext); + WordTextSegmentIterator.getInstance( + mContext.getResources().getConfiguration().locale); iterator.initialize(text.toString()); return iterator; } -- cgit v1.2.3