I am using MonoDevelop for Android and would please like some help with creating a custom toast.
Here is my code:
static public void DisplayCustomToast (Context displayContext, string stringText, int offsetX, int offsetY)
{
Toast toast = new Toast(displayContext);
toast.SetText(stringText);
toast.SetGravity (GravityFlags.Top, offsetX, offsetY);
//toast.Show;
}
This code is not working. It Builds successfully, yet the application doesn’t start properly.
If I uncomment the ‘toast.show’, get the following error:
Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement.
May I please have some help in getting this code working?
Thanks
The syntax
toast.Showimplies thatShowis either a property or a field. That’s why the calltoast.Showis illegal.However, I believe
Showis a method. So you must invoke it this way:toast.Show();