Fix as-you-type formatter for new contacts
It looks like for new contacts onPostExecute() gets executed
before the target view is attacheed.
Removed the "is view attached?" check, as addTextChangedListener()
is actually safe to call even if the target view is not attached.
Bug 5362018
Bug 5385441
Change-Id: I178063c4e061fdcab27e25b9dfdc7fe25fd97153
diff --git a/src/com/android/contacts/util/PhoneNumberFormatter.java b/src/com/android/contacts/util/PhoneNumberFormatter.java
index 6e63aac..204ac69 100644
--- a/src/com/android/contacts/util/PhoneNumberFormatter.java
+++ b/src/com/android/contacts/util/PhoneNumberFormatter.java
@@ -49,9 +49,7 @@
if (watcher == null || isCancelled()) {
return; // May happen if we cancel the task.
}
- if (mTextView.getHandler() == null) {
- return; // View is already detached.
- }
+ // Setting a text changed listener is safe even after the view is detached.
mTextView.addTextChangedListener(watcher);
// Note changes the user made before onPostExecute() will not be formatted, but