title: Send javascript to phonegap web view
body: <p>i am working on android app with phonegap, i want send a piece of JavaScript from native Java code like &quot;alert('23')&quot; to web view, but how?</p>
  <p>Details:</p>
  <blockquote>
  <p>Phonegap: <strong>3.0.0</strong></p>
  <p>Platform: <strong>Android</strong></p>
  </blockquote>
  <p>i use <code>sendJavascript</code> function for this purpose but nothing happened and not working for me.</p>
  <p>My code:</p>
  <pre><code>public class HelloWorld extends DroidGap
  {
      @Override
      public void onCreate(Bundle savedInstanceState)
      {
          super.onCreate(savedInstanceState);
          // Set by &lt;content src=&quot;index.html&quot; /&gt; in config.xml
          super.loadUrl(Config.getStartUrl());
          //super.loadUrl(&quot;file:///android_asset/www/index.html&quot;)
          Intent intent = getIntent();
          String action = intent.getAction();
          String type = intent.getType();
          if (Intent.ACTION_SEND.equals(action) &amp;&amp; type != null) {
              this.handleSendText(intent);
          }
      }
      
      public void handleSendText(Intent intent)
      {
          String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
          if (sharedText != null) {
              String js = String.format(&quot;callss('%s');&quot;, &quot;hadi&quot;);
  
              // code to send JavaScript
              this.sendJavascript(js);
          }
      }
      
  }
  </code></pre>
  <p>somewhere i read about use webView.sendJavascript instead, but webView is not accessible.
  if any extra information must be presented describe them.</p>