Hi All
Play store has logged a couple of ANR's for one of my Apps. The reports ae about 2 weeks apart and from the same type of device [MOTOG].
I have no idea how to read/interpret these reports.
Reading the forum it appears the most common cause of ANRs is large loops.
The only thing I can pick from from the reports is both refer to a sub "send_to_display".
This sub does have loops but should be small unless I have messed up.
Can someone with real knowledge please have a quick look and point me in the right direction.
ANR report attached.
Regards Roger
Play store has logged a couple of ANR's for one of my Apps. The reports ae about 2 weeks apart and from the same type of device [MOTOG].
I have no idea how to read/interpret these reports.
Reading the forum it appears the most common cause of ANRs is large loops.
The only thing I can pick from from the reports is both refer to a sub "send_to_display".
This sub does have loops but should be small unless I have messed up.
Can someone with real knowledge please have a quick look and point me in the right direction.
ANR report attached.
Regards Roger
B4X:
Sub send_to_display(R) ' according to the requested or required format
Dim limitdispR As String
Dim Explen As Int
Dim NumLength As Double
Dim digmax As Int
Dim digmin As Int
Dim ExplenStr As String
Dim chars As String = "0123456789ABCDEF"
Dim Strnum As String
Dim Strlength As Int
Dim Strstart As Int
Dim Res As String
Dim j As Int = 0
If Radix_Flag = 10 Then
If R <> "" Then
If R = "" Then R = 0
limitdispR = R
Explen = 0
Strlength = 0
If FSE_Flag < 2 Then 'Display mode is either normal or fixed decimal places
If FSE_Flag = 1 Then
digmax = FSEF
digmin = FSEF
Else
digmax = digits
digmin = 0
End If
'If number to big to display convert to exponetial display
NumLength = Power(10,(13 - digmax))
If Abs(R) > NumLength Then '99999
Do While Abs(limitdispR) > NumLength '999
limitdispR = limitdispR/10
Explen = Explen + 1
ExplenStr = Explen
Strlength = ExplenStr.Length
Loop
R = limitdispR
If Explen < 10 Then
Rdisplay.Text = NumberFormat2(R, 1,digmax,digmin,True)
lblEXP.Text = " E0" & Explen
End If
If Explen > 9 Then
Rdisplay.Text = NumberFormat2(R, 1,digmax,digmin,True)
lblEXP.Text = " E" & Explen
End If
'If number to small to display convert to exponential display
Else If Abs(R) < .0001 AND R <> 0 Then
Do While Abs(R) < 1
R = R * 10
Explen = Explen - 1
Loop
If Abs(Explen)< 10 Then
Rdisplay.Text = NumberFormat2(R, 1,digmax,digmin,True)
lblEXP.Text = " E-0" & Abs(Explen)
End If
If Abs(Explen) > 9 Then
Rdisplay.Text = NumberFormat2(R, 1,digmax,digmin,True)
lblEXP.Text = " E" & Explen
End If
Else
Rdisplay.Text = NumberFormat2(R, 1,digmax,digmin,True)
lblEXP.Text = ""
End If
'Display mode is in Scientific Format n.nnnn Enn
Else If FSE_Flag = 2 Then
digmax = FSES
digmin = 1
If Abs(limitdispR) > 10 Then
Do While Abs(limitdispR) > 10
limitdispR = limitdispR/10
Explen = Explen + 1
ExplenStr = Explen
Loop
R = limitdispR
If Explen < 10 Then
Rdisplay.Text = NumberFormat2(R, 1,digmax,digmin,True)
lblEXP.Text = " E0" & Explen
End If
If Explen > 9 Then
Rdisplay.Text = NumberFormat2(R, 1,digmax,digmin,True)
lblEXP.Text = " E" & Explen
End If
Else If Abs(limitdispR) < 1 AND (limitdispR) <> 0 Then
Do While Abs(limitdispR) < 1
limitdispR = limitdispR * 10
Explen = Explen - 1
Loop
R = limitdispR
If Abs(Explen)< 10 Then
Rdisplay.Text = NumberFormat2(R, 1,digmax,digmin,True)
lblEXP.Text = " E-0" & Abs(Explen)
End If
If Abs(Explen) > 9 Then
Rdisplay.Text = NumberFormat2(R, 1,digmax,digmin,True)
lblEXP.Text = " E" & Explen
End If
Else
Rdisplay.Text = NumberFormat2(R, 1,digmax,digmin,True)
lblEXP.Text = " E" & Explen
End If
'Display mode is in Engineering Format
Else If FSE_Flag = 3 Then
digmax = FSEE
digmin = 1
If Abs(limitdispR) > 1000 Then
Do While Abs(limitdispR) > 1000
limitdispR = limitdispR/1000
Explen = Explen + 3
ExplenStr = Explen
Loop
R = limitdispR
If Explen < 10 Then
Rdisplay.Text = NumberFormat2(R, 1,digmax,digmin,True)
lblEXP.Text = " E0" & Explen
End If
If Explen > 9 Then
Rdisplay.Text = NumberFormat2(R, 1,digmax,digmin,True)
lblEXP.Text = " E" & Explen
End If
Else If Abs(limitdispR) < 1 AND (limitdispR) <> 0 Then
Do While Abs(limitdispR) < 1
limitdispR = limitdispR * 1000
Explen = Explen - 3
Loop
R = limitdispR
If Abs(Explen)< 10 Then
Rdisplay.Text = NumberFormat2(R, 1,digmax,digmin,True)
lblEXP.Text = " E-0" & Abs(Explen)
End If
If Abs(Explen) > 9 Then
Rdisplay.Text = NumberFormat2(R, 1,digmax,digmin,True)
lblEXP.Text = " E" & Explen
End If
Else
Rdisplay.Text = NumberFormat2(R, 1,digmax,digmin,True)
lblEXP.Text = " E" & Explen
End If
End If
Idisplay.Text = ""
End If
Else ' Radix_flag = 2 or 8 or 16
Res = ""
Strnum = ""
If R = 0 Then Strnum = 0
If R <0 Then 'If number is negative convert to 12 digit signed number
R = (Power(Radix_Flag,12)+R)
End If
Do While R > 0 'Converts number in to character string
Strnum = chars.charAt(R Mod Radix_Flag) & Strnum
R = Floor(R / Radix_Flag)
Loop
Strlength = Strnum.Length
Strstart = Strlength - Min(Strlength, 12)
Strnum = Strnum.SubString2(Strstart, Strlength)
Strnum = Strnum.ToUpperCase
Strlength = Strnum.Length
For M = Strlength-1 To 0 Step -1 'Adds comma every 4 digits
Res = Strnum.SubString2(M,M+1) & Res
j = j + 1
If (j = 4 OR j = 8) AND Strlength > j Then
Res = "," & Res
End If
Next
Rdisplay.Text = Res
lblEXP.Text = ""
End If
End Sub