1

我从 Android 市场报告中得到了这个疯狂的例外。它每周大约发生 4-6 次(我们有超过 10 万的用户群)。我在堆栈下附加了代码片段。我什至找不到 Text.java 源代码。

java.lang.ArrayIndexOutOfBoundsException: result:3
at android.graphics.Text.setPaint(Native Method)
at android.graphics.Text.setPaint(Text.java:211)
at android.text.Layout.each(Layout.java:350)
at android.text.Layout.decorateText(Layout.java:312)
at android.text.Layout.reflow(Layout.java:410)
at android.text.Layout.reflowFull(Layout.java:369)
at android.text.StaticLayout.<init>(StaticLayout.java:114)
at android.text.StaticLayout.<init>(StaticLayout.java:67)
at android.text.StaticLayout.<init>(StaticLayout.java:51)
at android.widget.TextView.makeNewLayout(TextView.java:5315)
at android.widget.TextView.checkForRelayout(TextView.java:5765)
at android.widget.TextView.setText(TextView.java:2781)
at android.widget.TextView.setText(TextView.java:2649)
at android.widget.TextView.setText(TextView.java:2624)
at com.soakmein.MessageListView$StreamAdapter.getView(MessageListView.java:1042)
at android.widget.HeaderViewListAdapter.getView(HeaderViewListAdapter.java:220)
at android.widget.AbsListView.obtainView(AbsListView.java:1498)
at android.widget.ListView.makeAndAddView(ListView.java:1749)
at android.widget.ListView.fillUp(ListView.java:704)
at android.widget.ListView.fillGap(ListView.java:650)
at android.widget.AbsListView.trackMotionScroll(AbsListView.java:3521)
at android.widget.AbsListView.onTouchEvent(AbsListView.java:2339)
at android.widget.ListView.onTouchEvent(ListView.java:3447)
at android.view.View.dispatchTouchEvent(View.java:3952)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:995)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1034)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1034)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1034)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1034)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1711)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1145)
at android.app.Activity.dispatchTouchEvent(Activity.java:2096)

这是触发 excpetion 的行:

messageText.setText(Html.fromHtml(text));
4

1 回答 1

0

也许您可以发布源代码。

除此之外,我建议您遍历堆栈,直到找到发生越界错误的行。

您可能正在使用一个变量来跟踪数组的索引,并且该变量不受与您的数组具有相同边界的规则的限制。

于 2012-07-18T21:16:02.143 回答