i have ANR in google play console:
project.xmsgbx._settextcustomsize
Input dispatching timed out
my code is :
i know problem is related to do while, how can i correct it?
my code is related to custom msgbox: https://www.b4x.com/android/forum/t...s-please-provide-your-feedback.92614/#content
project.xmsgbx._settextcustomsize
Input dispatching timed out
my code is :
B4X:
Sub SetTextCustomSize(lbl As Label, txt As String) As Int
Dim dt As Float
Dim limit = 0.5 As Float
Dim h As Int
Dim pad() As Int = lbl.Padding
Dim TopPadding As Int = pad(1)
Dim BottomPadding As Int = pad(3)
Dim LeftPadding As Int = pad(0)
Dim RightPadding As Int = pad(2)
Dim TotalToExclude As Int = (TopPadding + BottomPadding + (LeftPadding/2 )+ (RightPadding /2) )
lbl.TextSize = 11
dt = lbl.TextSize
h = mStringUtils.MeasureMultilineTextHeight( lbl, txt) + TotalToExclude
Do While dt > limit Or h > lbl.Height
dt = dt / 2
h = mStringUtils.MeasureMultilineTextHeight(lbl, txt) + TotalToExclude
If h > lbl.Height Then
lbl.TextSize = lbl.TextSize - dt
Else
lbl.TextSize = lbl.TextSize + dt
End If
Loop
Return lbl.TextSize
End Sub
i know problem is related to do while, how can i correct it?
my code is related to custom msgbox: https://www.b4x.com/android/forum/t...s-please-provide-your-feedback.92614/#content
Last edited: