Android Question cannot catch error: measureLimit (973) is out of start (0) and limit (58) bounds

peacemaker

Expert
Licensed User
Longtime User
HI, All

What is such error about ?
I cannot catch it in debug mode, but very rare it's in Release.
 

peacemaker

Expert
Licensed User
Longtime User
Now i could catch it from a remote device log:

B4X:
--------- beginning of system --------- beginning of main --------- beginning of crash 
~e:java.lang.IndexOutOfBoundsException: measureLimit (37) is out of start (0) and limit (0) bounds ~e:
at android.text.TextLine.handleRun(TextLine.java:1106) ~e: at android.text.TextLine.measureRun(TextLine.java:528) ~e:
at android.text.TextLine.measure(TextLine.java:326) ~e: at android.text.Layout.getHorizontal(Layout.java:1187) ~e:
at android.text.Layout.getHorizontal(Layout.java:1165) ~e: at android.text.Layout.getPrimaryHorizontal(Layout.java:1136) ~e:
at android.widget.TextView.bringPointIntoView(TextView.java:9347) ~e: at android.widget.TextView.onPreDraw(TextView.java:6975) ~e:
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:993) ~e: at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2704) ~e:
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1636) ~e: at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7946) ~e:
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1092) ~e: at android.view.Choreographer.doCallbacks(Choreographer.java:893) ~e:
at android.view.Choreographer.doFrame(Choreographer.java:812) ~e: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1078) ~e:
at android.os.Handler.handleCallback(Handler.java:907) ~e: at android.os.Handler.dispatchMessage(Handler.java:105) ~e:
at android.os.Looper.loop(Looper.java:216) ~e: at android.app.ActivityThread.main(ActivityThread.java:7625) ~e:
at java.lang.reflect.Method.invoke(Native Method) ~e: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524) ~e:
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
~i:*** Service (starter) Create *** ~l1314286858:Using FileProvider? true
~i:** Service (starter) Start ** ~i:** Activity (main) Create, isFirst = true **
~i:** Activity (main) Resume ** ~i:** Receiver (serv) OnReceive **
~i:** Activity (main) Pause, UserClosed = false ** sending message to waiting queue (sleep)
~i:*** Service (apiservice) Create ***
~i:** Service (apiservice) Start **
~i:*** Service (serv) Create ***
~i:** Service (serv) Start **
~i:** Service (apiservice) Start **
~i:** Service (serv) Start **
 
Last edited:
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
CSBuilder is not user at all. Interface has a EditText for long log text.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Yes, i do so after got such error:


B4X:
Sub Add_Log(text As String)
    Try
        If txtLog.Text <> "" Then
            Dim length As Int = txtLog.Text.Length
            Dim lim As Int = 30000
            If length > lim Then
                Dim a As String = txtLog.Text.SubString(text.Length)
            Else
                Dim a As String = txtLog.Text
            End If
        End If
        txtLog.Text =  a & CRLF & text
        txtLog.SelectionStart = txtLog.Text.Length
    Catch
        'but sometime error is here
    End Try
End Sub

But it does not help. And this error text is not tied to a code line\place - i'm not sure that it's during "Sub Add_Log"
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User

Yes, showing logcat text by:

B4X:
Private Sub logcat_LogCatData (Buffer() As Byte, Length As Int)
    Dim a As String = BytesToString(Buffer, 0, Length, "utf8")
    logs.Append(a)
    others.AddToLog(a)  ' sending to Main.Add_Log

    If logs.Length > 15000 Then
        logs.Remove(0, logs.Length - 14000)
    End If
End Sub
 
Upvote 0
Top