diff options
Diffstat (limited to 'Xamarin.Forms.Platform.Android/Forms.cs')
-rw-r--r-- | Xamarin.Forms.Platform.Android/Forms.cs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Xamarin.Forms.Platform.Android/Forms.cs b/Xamarin.Forms.Platform.Android/Forms.cs index c2dc770b..6f3346fb 100644 --- a/Xamarin.Forms.Platform.Android/Forms.cs +++ b/Xamarin.Forms.Platform.Android/Forms.cs @@ -262,9 +262,16 @@ namespace Xamarin.Forms double _microSize; double _smallSize; + static Handler s_handler; + public void BeginInvokeOnMainThread(Action action) { - new Handler(Looper.MainLooper).Post(action); + if (s_handler == null || s_handler.Looper != Looper.MainLooper) + { + s_handler = new Handler(Looper.MainLooper); + } + + s_handler.Post(action); } public Ticker CreateTicker() |