using System; using System.Collections.Generic; using System.Linq; using System.Text; using Android.App; using Android.Content; using Android.OS; using Android.Runtime; using Android.Views; using Android.Widget; using Android.Media; namespace ArriveAlarm { public class PlaySound { protected MediaPlayer player = null; public void Play(string strPathFile) { if (this.player == null) this.player = new MediaPlayer(); if (this.player != null) { try { this.player.Reset(); this.player.SetDataSource(strPathFile); this.player.Prepare(); this.player.Start(); } catch { } } } public void Stop() { if(this.player!=null) this.player.Stop(); } } }