title: Sometimes throws Uncaught Error: Error calling method on NPObject on Android
body: <p>I am having problems with the Webview in Android and it's JavascriptInterfaces.</p>
  
  <p>I am passing a string to the JavascriptInterface. When debugging it, I receive the correct string within my Android application. The problem: Sometimes I get an Uncaught Error: Error calling method on NPObject.</p>
  
  <p>Does anybody know why?</p>
  
  <p>The Interface in Java:</p>
  
  <pre><code>public class JSInterfaceGame extends JSInterface {
  
  @JavascriptInterface
  public void setShareText(String share){
      shareText = share;
      if(mJSInterfaceListener != null)
          mJSInterfaceListener.onParametersChanged(SHARE_TEXT);
  }
  </code></pre>
  
  <p>The initialization in the onCreateView-Method within the Fragment:</p>
  
  <pre><code>online = (WebView) rootView.findViewById(R.id.online);
  online.setWebViewClient(new WISWebviewClient() {
    @Override
    public void onStatusChanged(final WebView view, int progress, long duration) {
      //unrelated
    }
  });
  
  WebSettings ws = online.getSettings();
  ws.setJavaScriptEnabled(true);
  ws.setUserAgentString(USER_AGENT);
  ws.setCacheMode(WebSettings.LOAD_DEFAULT);
  ws.setRenderPriority(WebSettings.RenderPriority.HIGH);
  
  SharedPreferences settings = getActivity().getSharedPreferences(GameActivity.PREFERENCES, Context.MODE_PRIVATE);
  
  mJSInterface = new JSInterfaceGame();
  mJSInterface.setJSInterfaceListener(this); // Defined elsewhere in this class.
  mJSInterface.setPlayerName(settings.getString(GameActivity.PREFS_PlAYERNAME, null));
  online.addJavascriptInterface(mJSInterface, "JSInterface");
  online.loadUrl("http://myurl.something");
  </code></pre>
  
  <p>Call in Javascript:</p>
  
  <pre><code>function makeShareText() {
    var text = "Some text";
    console.log(typeof text); // Always a string.
    JSInterface.setShareText(text);
  }
  </code></pre>