OSDN Git Service

Use TextUtils.substring instead of String.substring.
authorSeigo Nonaka <nona@google.com>
Fri, 7 Aug 2015 23:42:22 +0000 (16:42 -0700)
committerSeigo Nonaka <nona@google.com>
Fri, 7 Aug 2015 23:42:22 +0000 (16:42 -0700)
This is a small refactoring of using substring method.
Calling TextUtils.substring is more efficient than calling
toString and String.substring.

Change-Id: I0a740b2a2fdbfb6b6155c4e926e17889025082f5

core/java/android/widget/Editor.java

index 010cb27..15353bb 100644 (file)
@@ -3023,7 +3023,7 @@ public class Editor {
                 return;
             }
 
-            final String originalText = editable.toString().substring(spanStart, spanEnd);
+            final String originalText = TextUtils.substring(editable, spanStart, spanEnd);
 
             if (suggestionInfo.suggestionIndex == ADD_TO_DICTIONARY) {
                 Intent intent = new Intent(Settings.ACTION_USER_DICTIONARY_INSERT);