title: How to inject a JS object which can be called as a constructor in Android?
body: <p>I need to implement a JS object and use it like this (JavaScript code):</p>
  
  <pre><code>var mp = new MediaPlayer();
  </code></pre>
  
  <p>It was fine in QtWebkit and this is how I inject this JS object (C++ code):</p>
  
  <pre><code>static JSClassDefinition SomeClassDefinition = {
      .....
      callAsConstructor: SomeClassCallAsConstructor,
      .....
  }
  
  webview-&gt;addToJavaScriptWindowObject( context, "SomeObject", &amp; SomeClassDefinition );
  </code></pre>
  
  <p>I'd like to port this module to Android and I try to use WebView:addJavascriptInterface() to inject this this into WebView in Android. Somehow it can't be used as a constructor like this:</p>
  
  <pre><code>var mp = new MediaPlayer();
  </code></pre>
  
  <p>The result is always undefined. </p>
  
  <p>How can I make this work in Android just like in QtWebKit? </p>
  
  <p>Thanks a lot.</p>