protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); //create a new dialog dialog = CustomProgressDialog.CreateDialog(this); dialog.OnWindowFocusChanged(true); Button btnGO = FindViewById<Button>(Resource.Id.go); btnGO.Click += (s,e) => { int result = 0; //show the dialog dialog.Show(); //do some things Task task = new Task(() => { for (int i = 0; i < 100; i++) { result += i; } }); task.ContinueWith(t => { Intent intent = new Intent(this, typeof(LastActivity)); intent.PutExtra("name", result.ToString()); StartActivity(intent); }); task.Start(); }; }