Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim mp As MediaPlayer
Dim CanPlay As Boolean
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 btnStart As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
If FirstTime Then
mp.Initialize
mp.Load(File.DirAssets,"provasound3.ogg")
mp.Looping = True
End If
CanPlay = False
btnStart.Initialize("Music")
Activity.AddView(btnStart,10dip,10dip,50dip,50dip)
btnStart.Text = "Play"
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
If UserClosed Then
mp.Release
End If
End Sub
Sub Music_Click
CanPlay = Not(CanPlay)
If CanPlay Then
mp.Play
btnStart.Text = "Stop"
Else
mp.Pause
btnStart.Text = "Play"
End If
End Sub