Forum Xamarin.Android

How to make a toast if I can't declare a context? (SOLVED)

AyhamNajemAyhamNajem USMember
edited June 2016 in Xamarin.Android

Hello everyone,

I want to make a toast after dismissing an Inflated layout, but I can't


        void client_UploadValuesCompleted(object sender, UploadValuesCompletedEventArgs e)
        {
            Activity.RunOnUiThread(() =>
            {
                string id = Encoding.UTF8.GetString(e.Result); //Get the data echo backed from PHP
                int newID = 0;

                int.TryParse(id, out newID); //Cast the id to an integer

                if (OnCreateContact != null)
                {
                    //Broadcast event
                    OnCreateContact.Invoke(this, new CreateContactEventArgs(newID, txtName.Text, txtEmail.Text, txtPhone.Text, "service", "sort", "prov", "date", "time"));

                }

                mProgressBar.Visibility = ViewStates.Invisible;
                this.Dismiss();
****         //I WANT THE TOAST HERE****       
            });
        }

I am using this code: Toast.MakeText(this, Resource.String.sent, ToastLength.Long).Show();

and I am having this error:
Argument 1: cannot convert from 'CustomActionBar_Tutorial.CreateContactDialog' to 'Android.Content.Context'

How can I solve this please?

Best Answer

Answers

Sign In or Register to comment.