Skip to content Skip to sidebar Skip to footer

Issues With Runonuithread Method

I'm facing the issue that my Xamarin application 'may be doing too much work on its main thread'. To circumvent this issue, I'm trying to move some heavy computations to their own

Solution 1:

I was finally able to solve this issue with the following code:

ContextContext= DependencyService.Get<AndroidPropertyHandler>().GetMainActivityContext();
        varActivity= (Activity) Context;
        RunnableMyRunnable=newRunnable(() => {
            Debug.WriteLine("My work goes here...");
        });
        Activity.RunOnUiThread(MyRunnable);

, where "AndroidPropertyHandler" is an interface providing access to the static context.

Post a Comment for "Issues With Runonuithread Method"