Sub Process_Globals 'These global variables will be declared once when the application starts. 'These variables can be accessed from all modules. Dim MediaPlayer1 As MediaPlayer Dim Timer1 As Timer 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. Private btnDi As Button Private btnGa As Button Private btnKe As Button Private btnNi As Button Private btnPa As Button Private btnVou As Button Private btnZo As Button Dim barPosition As SeekBar Dim barVolume As SeekBar Dim lblPosition As Label Dim Looping As ToggleButton End Sub Sub Activity_Create(FirstTime As Boolean) 'Do not forget to load the layout file created with the visual designer. For example: If FirstTime Then MediaPlayer1.Initialize2("mp" ) Timer1.Initialize("timer1", 1000) End If Activity.LoadLayout("Main") Looping_CheckedChange(Looping.Checked) 'set the default value btnPa.Text = "ะม" End Sub Sub mp_Complete MediaPlayer1.Play End Sub Sub Activity_Resume MediaPlayer1.Play Timer1.Enabled = True timer1_Tick 'don't wait one second for the UI to update. End Sub Sub Activity_Pause (UserClosed As Boolean) If MediaPlayer1.IsPlaying Then MediaPlayer1.Pause Timer1.Enabled = False End Sub Sub timer1_Tick If MediaPlayer1.IsPlaying Then barPosition.Value = MediaPlayer1.Position / MediaPlayer1.Duration * 100 lblPosition.Text = "Position: " & ConvertToTimeFormat(MediaPlayer1.Position) & _ " (" & ConvertToTimeFormat(MediaPlayer1.Duration) & ")" If MediaPlayer1.Position > 4000 Then MediaPlayer1.Position = 100 End If End If End Sub 'converts milliseconds to m:ss format. Sub ConvertToTimeFormat(ms As Int) As String Dim seconds, minutes As Int seconds = Round(ms / 1000) minutes = Floor(seconds / 60) seconds = seconds Mod 60 Return NumberFormat(minutes, 1, 0) & ":" & NumberFormat(seconds, 2, 0) 'ex: 3:05 End Sub Sub barVolume_ValueChanged (Value As Int, UserChanged As Boolean) MediaPlayer1.SetVolume(barVolume.Value / 100, barVolume.Value / 100) End Sub Sub barPosition_ValueChanged (Value As Int, UserChanged As Boolean) If UserChanged = False Then Return 'the value was changed programmatically MediaPlayer1.Position = Value / 100 * MediaPlayer1.Duration If MediaPlayer1.IsPlaying = False Then 'this can happen when the playback reached the end and the user changes the position MediaPlayer1.Play End If timer1_Tick 'immediately update the progress label End Sub Sub btnZo_Click End Sub Sub btnVou_Click End Sub Sub btnPa_Click If MediaPlayer1.IsPlaying Then MediaPlayer1.Stop MediaPlayer1.Load(File.DirAssets, "NoteBA.ogg") MediaPlayer1.Play End Sub Sub btnNi_Click End Sub Sub btnKe_Click End Sub Sub btnGa_Click End Sub Sub btnDi_Click End Sub Sub Looping_CheckedChange(Checked As Boolean) MediaPlayer1.Looping = Checked End Sub