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 ' Must be in Process_Globals
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 path1 As String
Dim fileList As List
Dim FilePntr As Int
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")
MP.Initialize2("MP")
path1 = "Your album directory"
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub btnPlayAlbum_Click
' Get the list of files to play
fileList = File.ListFiles(path1)
fileList.Sort(True)
' If there are files, start playing the first one
If fileList.Size>0 Then
FilePntr=0
MP.Load(path1, fileList.Get(FilePntr))
MP.Play
End If
End Sub
' Called when the current track completes
Sub MP_Complete
' Point to the next song
FilePntr=FilePntr+1
' If there are more songs, start playing the next one
If FilePntr < fileList.Size Then
MP.Load(path1, fileList.Get(FilePntr))
MP.Play
Else
ToastMessageShow("Album done!", True)
End If
End Sub