简体   繁体   English

设置TextView文本时崩溃

[英]Crash when set TextView text

crash reporting catch two crashed after calling TextView.setText() with valid string (formated as "Session 16/09/2015 10:12") 崩溃报告捕获了两个以有效字符串(格式为“会话16/09/2015 10:12”)调用TextView.setText()后崩溃的事件

on nexus7 with 5.0.2 and Galaxy S6 (SM-G925F) with 5.1.1 I cannot find steps to reproduce it 在带有5.0.2的nexus7和带有5.1.1的Galaxy S6(SM-G925F)上,我找不到重现它的步骤

Android: 5.0.2 Manufacturer: asus Model: Nexus 7 Android:5.0.2制造商:asus型号:Nexus 7

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.text.method.WordIterator.setCharSequence(java.lang.CharSequence, int, int)' on a null object reference at android.widget.SpellChecker$SpellParser.parse(SpellChecker.java:559) at android.widget.SpellChecker$SpellParser.parse(SpellChecker.java:516) at android.widget.SpellChecker.spellCheck(SpellChecker.java:257) at android.widget.Editor.updateSpellCheckSpans(Editor.java:541) at android.widget.Editor.sendOnTextChanged(Editor.java:1017) at android.widget.TextView.sendOnTextChanged(TextView.java:7667) at android.widget.TextView.setText(TextView.java:4050) at android.widget.TextView.setText(TextView.java:3905) at android.widget.EditText.setText(EditText.java:85) at android.widget.TextView.setText(TextView.java:3880) ....my code that calls setText() java.lang.NullPointerException:尝试在android.widget.SpellChecker $ SpellParser.parse()上的空对象引用上调用虚拟方法'void android.text.method.WordIterator.setCharSequence(java.lang.CharSequence,int,int)' android.widget.SpellChecker $ SpellParser.parse(SpellChecker.java:516)位于android.widget.SpellChecker.spellCheck(SpellChecker.java:257)位于android.widget.Editor.updateSpellCheckSpans(Editor.java) :541)在android.widget.Editor.sendOnTextChanged(Editor.java:1017)在android.widget.TextView.sendOnTextChanged(TextView.java:7667)在android.widget.TextView.setText(TextView.java:4050) .widget.TextView.setText(TextView.java:3905)位于android.widget.EditText.setText(EditText.java:85)位于android.widget.TextView.setText(TextView.java:3880).... my代码调用setText()

Does anybody seen something like this? 有人看到过这样的东西吗? Seems android crashes when try use spellchecker and show suggestions. 尝试使用拼写检查器并显示建议时,似乎Android崩溃。 I`m going to disable it with 我要用禁用它

android:inputType="textNoSuggestions" android:inputType =“ textNoSuggestions”

May this help? 这可以帮助吗?

public boolean isSuggestionsEnabled () 公共布尔isSuggestionsEnabled()

Added in API level 14 Return whether or not suggestions are enabled on this TextView. API级别14中添加返回是否在此TextView上启用建议。 The suggestions are generated by the IME or by the spell checker as the user types. 这些建议是由IME或拼写检查器在用户键入时生成的。 This is done by adding SuggestionSpans to the text. 这是通过在文本中添加“ SuggestationSpans”来完成的。 When suggestions are enabled (default), this list of suggestions will be displayed when the user asks for them on these parts of the text. 启用建议后(默认),当用户在文本的这些部分中提出建议时,将显示此建议列表。 This value depends on the inputType of this TextView. 此值取决于此TextView的inputType。 The class of the input type must be TYPE_CLASS_TEXT. 输入类型的类别必须为TYPE_CLASS_TEXT。 In addition, the type variation must be one of TYPE_TEXT_VARIATION_NORMAL, TYPE_TEXT_VARIATION_EMAIL_SUBJECT, TYPE_TEXT_VARIATION_LONG_MESSAGE, TYPE_TEXT_VARIATION_SHORT_MESSAGE or TYPE_TEXT_VARIATION_WEB_EDIT_TEXT. 此外,类型变体必须是TYPE_TEXT_VARIATION_NORMAL,TYPE_TEXT_VARIATION_EMAIL_SUBJECT,TYPE_TEXT_VARIATION_LONG_MESSAGE,TYPE_TEXT_VARIATION_SHORT_MESSAGE或TYPE_TEXT_VARIATION_WEB_EDIT_TEXT之一。 And finally, the TYPE_TEXT_FLAG_NO_SUGGESTIONS flag must not be set. 最后, 不得设置TYPE_TEXT_FLAG_NO_SUGGESTIONS标志。

Returns true if the suggestions popup window is enabled, based on the inputType. 如果基于输入类型启用了建议弹出窗口,则返回true。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM