public static T MainThreadCall <T>(this AndroidJavaObject ajo, string methodName, params object[] args)
        {
            T    result = default(T);
            bool wasSet = false;

            JniToolkitUtils.RunOnUiThread(() =>
            {
                try
                {
                    result = ajo.Call <T>(methodName, args);
                }
                catch
                {
                    // Ignored
                }
                finally
                {
                    wasSet = true;
                }
            });
            while (!wasSet)
            {
                // Hack for IL2CPP to not optimize the loop
                hackyDummy++;
            }
            return(result);
        }
        public static void MainThreadCall(this AndroidJavaObject ajo, string methodName, params object[] args)
        {
            bool finished = false;

            JniToolkitUtils.RunOnUiThread(() =>
            {
                try
                {
                    ajo.Call(methodName, args);
                }
                catch
                {
                    // Ignored
                }
                finally
                {
                    finished = true;
                }
            });
            while (!finished)
            {
                // Hack for IL2CPP to not optimize the loop
                hackyDummy++;
            }
        }
 public static void MainThreadCallNonBlocking(this AndroidJavaObject ajo, string methodName, params object[] args)
 {
     JniToolkitUtils.RunOnUiThread(() => ajo.Call(methodName, args));
 }