diff options
author | Jean Chalard <jchalard@google.com> | 2013-06-14 13:10:07 +0900 |
---|---|---|
committer | Jean Chalard <jchalard@google.com> | 2013-06-14 13:10:07 +0900 |
commit | 8385f1c622e20489d665a3d083b4dd8243f46c64 (patch) | |
tree | 862a8c68709984f9673bd3ccde9a7688d5311653 /src/com/android/settings/inputmethod/UserDictionaryAddWordContents.java | |
parent | ff8fbf095665cf10922957d90317bc6319bbc3dd (diff) | |
download | packages_apps_Settings-8385f1c622e20489d665a3d083b4dd8243f46c64.zip packages_apps_Settings-8385f1c622e20489d665a3d083b4dd8243f46c64.tar.gz packages_apps_Settings-8385f1c622e20489d665a3d083b4dd8243f46c64.tar.bz2 |
Fix a bug where a user dict entry is too long
Since there is a maxLength attribute to the text field, if the
requested entry is too long for the text field it will be truncated,
then setSelection will crash with an IOOB exception.
Bug: 9410958
Change-Id: I7e916b4d77d338f49db7d3dab4e536d27ec76bc1
Diffstat (limited to 'src/com/android/settings/inputmethod/UserDictionaryAddWordContents.java')
-rw-r--r-- | src/com/android/settings/inputmethod/UserDictionaryAddWordContents.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/com/android/settings/inputmethod/UserDictionaryAddWordContents.java b/src/com/android/settings/inputmethod/UserDictionaryAddWordContents.java index 3251216..5efe117 100644 --- a/src/com/android/settings/inputmethod/UserDictionaryAddWordContents.java +++ b/src/com/android/settings/inputmethod/UserDictionaryAddWordContents.java @@ -64,7 +64,9 @@ public class UserDictionaryAddWordContents { final String word = args.getString(EXTRA_WORD); if (null != word) { mWordEditText.setText(word); - mWordEditText.setSelection(word.length()); + // Use getText in case the edit text modified the text we set. This happens when + // it's too long to be edited. + mWordEditText.setSelection(mWordEditText.getText().length()); } final String shortcut = args.getString(EXTRA_SHORTCUT); if (null != shortcut && null != mShortcutEditText) { |