private async Task addToPlaylist(string playlist, int sid, int status) { string ret = string.Empty; StaticMethods.ShowLoader(); Task.Factory.StartNew( // tasks allow you to use the lambda syntax to pass wor () => { ret = WebService.AddToPlaylist(sid, playlist, status); }).ContinueWith( t => { Device.BeginInvokeOnMainThread(() => { if (ret == "success") { StaticMethods.ShowToast("Successfully added to playlist."); } }); }, TaskScheduler.FromCurrentSynchronizationContext() ); }