I'm creating a simple app that plays music in Xamarin Android. I can't get the seekbar to update itself with the song's progress. In JAVA the Runnable interface is used.
Here is my code snippet
`protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.MediaPlayer);
player = Android.Media.MediaPlayer.Create(this, Resource.Raw.test);
playButton = FindViewById<Button>(Resource.Id.play);
pauseButton = FindViewById<Button>(Resource.Id.pause);
stopButton = FindViewById<Button>(Resource.Id.stop);
playButton.Click += OnPlayClick;
pauseButton.Click += OnPauseClick;
stopButton.Click += OnStopClick;
seekBar = FindViewById<SeekBar>(Resource.Id.seekBar);
}
private void OnPlayClick(object sender, EventArgs e)
{
player.Start();
}
private void OnPauseClick(object sender, EventArgs e)
{
player.Pause();
}
private void OnStopClick(object sender, EventArgs e)
{
player.Stop();
player.Prepare();
player.SeekTo(0);
}`
This is the basic player implementation.
This is the java version of what I want to do. How to use a Seekbar in android as a seekBar as well as a progressBar simultaneously?