mp.Load in Service_Create will crash the app
Service module named mp3service.bas:
Main Activity named mp3service.b4a:
This app will crash when i click the Start Button....
I found the problem is mp.Load("http://website/my.mp3") in Sub Service_Create.
Any help will be appreciate it.
Service module named mp3service.bas:
B4X:
Sub Process_Globals
Dim mp As MediaPlayerStream
End Sub
Sub Service_Create
mp.Load("http://website/my.mp3")
End Sub
Sub Service_Start (StartingIntent As Intent)
'mp.Play
End Sub
Sub Service_Destroy
'mp.Stop
End Sub
Sub mp_Complete
'ToastMessageShow("mp Complete..." , True)
End Sub
Sub mp_StreamReady
'mp.Play
End Sub
Sub mp_StreamError(ErrorCode As String, ExtraData As Int)
'ToastMessageShow("Error: " & ErrorCode & ", " & ExtraData, True)
'mp.Stop
End Sub
Main Activity named mp3service.b4a:
B4X:
Sub Process_Globals
End Sub
Sub Globals
Dim StartButton As Button
Dim StopButton As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
StartButton.Enabled = True
StopButton.Enabled = False
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause(UserClosed As Boolean)
StopService(mp3service)
End Sub
Sub StartButton_Click
StartButton.Enabled = False
StopButton.Enabled = True
StartService(mp3service)
End Sub
Sub StopButton_Click
StartButton.Enabled = True
StopButton.Enabled = False
StopService(mp3service)
End Sub
This app will crash when i click the Start Button....
I found the problem is mp.Load("http://website/my.mp3") in Sub Service_Create.
Any help will be appreciate it.
Last edited: