Android Question java.lang.Exception:

D

Deleted member 103

Guest
Hello,

This crash happens too often in Google Report, and I do not know where that comes from.
It would be nice if someone could help here.

Main-Code:

B4X:
Sub Activity_Create(FirstTime As Boolean)
...
    If FirstTime = True Then
                      
       ClockTimer.Initialize("ClockTimer", 100)
    End If

    ClockTimer.Enabled = True
...
End Sub

Sub ClockTimer_Tick
    Dim time As Long
    Dim IntervalFirst As Double
    Dim DistanceTheoretically As Double
    time = DateTime.Now - (Starter.lngTimer + Starter.lngSecGpsToFunk)

    dClock.Text = DateTime.time(time)

    If Starter.intClockSelected > -1 Then

        ...
        ...
                
    End If

    ShowSpeed(time)
    
    ShowAutoStart(time)
End Sub

Public Sub ShowAutoStart(time As Long)
    If pnlAutoStart.Visible Then
        Dim h, m, S As Int
        h = DateTime.GetHour(time)
        m = DateTime.GetMinute(time)
        S = DateTime.GetSecond(time)
        time = (S * DateTime.TicksPerSecond) + (m * DateTime.TicksPerMinute) + (h * DateTime.TicksPerHour)
        lblTime.Text = mBBL.getConvertTickToHHmmss(lblTime.Tag - time)

        Dim t As Int = (lblTime.Tag - time) / DateTime.TicksPerSecond
        If t <= 10 And Starter.Autostarttime <> t Then
            Starter.Autostarttime = t
            If t > 0 Then
                If Starter.IsSpeech Then
                    CallSub2(Starter,"Start_Speech", t)
                Else
                    CallSub(Starter,"Start_beep200")
                End If
            Else If t = 0 Then
                CallSub(Starter,"Start_beep500")
            End If
        End If

        If (lblTime.Tag - time) <= 0 Then
            btnCancel_Click
        End If
    End If
End Sub

Starter-Service:
B4X:
Public Sub Start_Speech(number As Int, lastBeep As Int)
    Dim firstbeep As Int = Min(10, lastBeep)
    If IsSpeechAllNumbers Then
        If number <= 10 Then 'Nur die letzte 10 sekunden werden als Sprache gesendet.
            'Log("1.Speech=" & number)
            If IsTTSReady Then
                TTS1.Speak(number, True)
            Else
                mplay(number).Play
            End If
        Else
            Start_beep200
        End If
    Else
        If number = firstbeep Then 'Nur die erste Zahl soll gesprochen.
            'Log("2.Speech=" & number)
            If IsTTSReady Then
                TTS1.Speak(number, True)
            Else
                mplay(number).Play
            End If
        Else
            Start_beep200
        End If
    End If
End Sub

Private Sub Start_beep200
    'Log("b200.Beep")
    b200.beep
End Sub

Private Sub Start_beep500
    'Log("b500.Beep")
    'Log(" ")
    b500.beep
End Sub


crash report:





 
D

Deleted member 103

Guest
Are you pausing the timer when the activity is paused?
Yes, I always do that.
B4X:
Sub Activity_Resume
    'Log("Activity_Resume")
    ClockTimer.Enabled = True
...
End Sub

Sub Activity_Pause (UserClosed As Boolean)
    'Log("Activity_Pause UserClosed=" & UserClosed)
    ClockTimer.Enabled = False
...
End Sub
 
Upvote 0
D

Deleted member 103

Guest
I think that the real error message is missing here. It probably happens in Start_Speech. Worth integrating Crashlytics. It will hopefully provide more information.
Thank you, then I have to try that.
 
Upvote 0
D

Deleted member 103

Guest
Thanks to Crashlytics, and of course Erel, I have now found the mistake.

The sub "Start_Speech" has 2 parameters, I started it with 1 paramter.

B4X:
CallSub2(Starter,"Start_Speech", t)
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…