title: Unity: Call android function from Unity
body: <pre><code>AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
  
  AndroidJavaObject activity = unityPlayer.GetStatic("currentActivity");
  
  activity.CallStatic("testMethod");
  </code></pre>
  
  <p>This is how I call Android static function without argument, and its works perfect. But I have issue when I'm trying to call non-static function with arguments.</p>
  
  <p>I'm trying to call it like that:</p>
  
  <pre><code>activity.Call("testMethod", "testString");
  </code></pre>
  
  <p>But Android throws exception:</p>
  
  <pre><code>AndroidJavaException: java.lang.NoSuchMethodError: no non-static method "L**myActivity**(Ljava/lang/String;)V"
  </code></pre>
  
  <p>What I do wrong ? What is the difference between static and non-static call ? I'm using the same activity. Here is my java method:</p>
  
  <pre><code>public void testMethod(String data) { }
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Finally was able to run non static method:</p>
  
  <pre><code>activity.Call("runOnUiThread", new AndroidJavaRunnable(() =&gt;
                                                                     {
                      activity.Call("testMethod", "testString");
              }));
  </code></pre>
  
  <p>That odd thats not working without runOnUIThread...Probably I did something wrong.</p>