Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

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;
****         //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


Sign In or Register to comment.