Hi all,
The following code runs fine the first time, but when you press the back button to close the app, then go back into the app, it errors with java.lang.RuntimeException: start failed.
How do I re-initialize the object after it stops listening in the _Pause event?
Richard
The following code runs fine the first time, but when you press the back button to close the app, then go back into the app, it errors with java.lang.RuntimeException: start failed.
How do I re-initialize the object after it stops listening in the _Pause event?
Richard
B4X:
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim T As Timer
Dim A As AudioRecorder
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Calls sub AmplitudeCheck every 500 milliseconds
A.Initialize
A.AudioSource=A.AS_MIC
A.OutputFormat=A.OF_THREE_GPP
A.AudioEncoder=A.AE_AMR_NB
A.setOutputFile("","/dev/null")
A.prepare
a.start
T.Initialize("AmplitudeCheck",500)
End Sub
Sub Activity_Resume
'Set up recorder
T.Enabled=True
End Sub
Sub Activity_Pause (UserClosed As Boolean)
T.Enabled=False
A.stop
End Sub
Sub AmplitudeCheck_tick
End Sub