When I changed my App from 10 to 11(Android) but it doen't work with Toast Component. This is my class
public class Toast_Android : IToast
{
public void Show(string message)
{
//Toast.MakeText(Android.App.Application.Context, message, ToastLength.Long).Show();
Toast toast = Toast.MakeText(Android.App.Application.Context, message, ToastLength.Long);
//if (toast.View == null) return;
//toast.SetGravity(Android.Views.GravityFlags., 0, 0);
LinearLayout layout = (LinearLayout)toast.View;
if (layout.ChildCount > 0)
{
TextView tv = (TextView)layout.GetChildAt(0);
tv.SetForegroundGravity(GravityFlags.CenterVertical | GravityFlags.CenterHorizontal);
//tv.TextAlignment = Android.Views.TextAlignment.Center;
}
// toast.SetGravity(GravityFlags.FillHorizontal | GravityFlags.Bottom, 0, 0);
toast.Show();
}
}
I put in this line(if (toast.View == null) return;) just to compile my code, but is wrong, of course.
How can i change this code for other and doesn't break my app?