summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Xamarin.Forms.Platform.Android/Forms.cs19
1 files changed, 13 insertions, 6 deletions
diff --git a/Xamarin.Forms.Platform.Android/Forms.cs b/Xamarin.Forms.Platform.Android/Forms.cs
index 2699241f..62e07f22 100644
--- a/Xamarin.Forms.Platform.Android/Forms.cs
+++ b/Xamarin.Forms.Platform.Android/Forms.cs
@@ -361,13 +361,20 @@ namespace Xamarin.Forms
public void StartTimer(TimeSpan interval, Func<bool> callback)
{
Timer timer = null;
- TimerCallback onTimeout = o => BeginInvokeOnMainThread(() =>
+ bool invoking = false;
+ TimerCallback onTimeout = o =>
{
- if (callback())
- return;
-
- timer.Dispose();
- });
+ if (!invoking)
+ {
+ invoking = true;
+ BeginInvokeOnMainThread(() =>
+ {
+ if (!callback())
+ timer.Dispose();
+ invoking = false;
+ });
+ }
+ };
timer = new Timer(onTimeout, null, interval, interval);
}