I'm having trouble figuring out this one out. I'm unable to reproduce on my phone (nexus 4). Doesn't seem to effect all devices but I have enough reports where it's frustrating to see it keep occurring.
java.lang.ArrayIndexOutOfBoundsException: length=10; index=10
at android.text.StaticLayout.calculateEllipsis(StaticLayout.java:938)
at android.text.StaticLayout.out(StaticLayout.java:859)
at android.text.StaticLayout.generate(StaticLayout.java:524)
at android.text.StaticLayout.<init>(StaticLayout.java:147)
at android.widget.TextView.makeSingleLayout(TextView.java:6583)
at android.widget.TextView.makeNewLayout(TextView.java:6429)
at android.widget.TextView.onMeasure(TextView.java:6807)
at android.view.View.measure(View.java:16047)
at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:1232)
at android.widget.TableRow.onMeasure(TableRow.java:114)
at android.view.View.measure(View.java:16047)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4921)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1410)
at android.widget.TableLayout.measureChildBeforeLayout(TableLayout.java:464)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
at android.widget.TableLayout.measureVertical(TableLayout.java:476)
at android.widget.TableLayout.onMeasure(TableLayout.java:439)
at android.view.View.measure(View.java:16047)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4921)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1410)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
at android.view.View.measure(View.java:16047)
at android.widget.ListView.measureScrapChild(ListView.java:1190)
at android.widget.ListView.measureHeightOfChildren(ListView.java:1255)
at android.widget.ListView.onMeasure(ListView.java:1165)
at android.view.View.measure(View.java:16047)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4921)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1410)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
at android.view.View.measure(View.java:16047)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4921)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.view.View.measure(View.java:16047)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
at android.view.View.measure(View.java:16047)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4921)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2418)
at android.view.View.measure(View.java:16047)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2129)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1282)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1493)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1179)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4861)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
at android.view.Choreographer.doCallbacks(Choreographer.java:562)
at android.view.Choreographer.doFrame(Choreographer.java:532)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5293)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
java.lang.ArrayIndexOutOfBoundsException. Thrown to indicate that an array has been accessed with an illegal index. The index is either negative or greater than or equal to the size of the array.
The ArrayIndexOutOfBoundsException is one of the most common errors in Java. It occurs when a program attempts to access an invalid index in an array i.e. an index that is less than 0, or equal to or greater than the length of the array.
The ArrayIndexOutOfBoundsException is a Runtime Exception thrown only at runtime. The Java Compiler does not check for this error during the compilation of a program.
Need to set attributes android:lines="1" android:singleLine="true"
https://code.google.com/p/android/issues/detail?id=33868
This is a bug. reported in android itself please ignore to use start. https://code.google.com/p/android/issues/detail?id=33868
Issue
android:maxLines="1" android:ellipsize="middle"
then our application crashes in some devices.Solution
"android:maxLines"
property then for "android:ellipsize"
property only End and Marquee is supported.Reference
setEllipsize
added in API level 1
void setEllipsize (TextUtils.TruncateAt where)
Causes words in the text that are longer than the view's width to be ellipsized instead of broken in the middle. You may also want to setSingleLine() or setHorizontallyScrolling(boolean) to constrain the text to a single line. Use null to turn off ellipsizing. If setMaxLines(int) has been used to set two or more lines, only END and MARQUEE are supported (other ellipsizing types will not do anything).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With