I am calling below function inside thread, but its not showing the alert message?
protected void RemindCurrentTime() { DateTime now = DateTime.Now; string currentTime = (string.Format ("Current Time: {0}", now)); Toast.MakeText (this, currentTime, ToastLength.Long).Show(); }
While running i set break-point, it executing that line, but resolving as Unknown identifier: Toast. Please someone help me...
Answers
http://docs.xamarin.com/guides/android/advanced_topics/writing_responsive_applications
RunOnUiThread (() => textview.Text = "Method Complete");
Hi Michael,
Thanks for your reply. When i use RunOnUiThread in my code, i am getting error, that
RunOnUiThread doesn't exist in current context
As documentaion says
However, unlike Activities, services don’t have a RunOnUIThread method. From services, a Handler can be used to achieve the same result.
Hence i think i can't use that but i am not sure. I want Notification alert from services. Hence i tried Handler method also, but no use
Is there any other way?
Have you tried http://docs.xamarin.com/guides/android/application_fundamentals/services/part_1_-_started_services 4.1. Using Notifications ?
Do you have
using Android.Widget;
Ya using Notification earlier i did as below
Above thing is working perfect. But my requirement is, i need to show like alert message, not notification. i am using Android Widget in my reference
On Android:
Toast.MakeText (this, "click", ToastLength.Long).Show ();
its not working for me.
I found the reason behind my project problem. The Visual Studio Emulator does not clear the earlier deployed app/project. For this I tried first close and restart VS Emulator then it worked. But every time it is not possible. Now thats new problem
This is how you get a toast from a background thread:
@RyanFrench I will kiss you on the mouth. Thank you!
Make Toast Message in Xamarin Forms,Here is full guide:

This saved my day!! thanks
@RyanFrench thanks! I won't kiss you on the mouth for which you are welcome as well!