I have the following views in my activity:
private Button btn;
private TextView txtView;
I have the following button click event:
private async void Btn_Click(object sender, System.EventArgs e)
{
var mDialog = new ProgressDialog(this);
mDialog.SetMessage("Loading data...");
mDialog.SetCancelable(false);
mDialog.Show();
string str;
await Task.Run((() => str = Foo()));
// Alternatively
// await Task.Delay(10000);
mDialog.Dismiss();
txtView.Text = str;
}
And I also have the following method:
string Foo()
{
for (int i = 0; i < 10; i++)
{
Thread.Sleep(1000);
}
return "hello";
}
What I want is txtView.Text to be set to hello after the ProgressDialog is dismissed