How to call JavaScript in Android 4.2
<p>I have already found many examples about how to call JavaScript from android. But it's not working for me. My target SDK is 17(android 4.2). This is how I am loading my html page from my activity:</p>

<pre><code>protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_test);

    myWebView = (WebView)findViewById(R.id.mapwebview1);
    WebSettings webSettings = myWebView.getSettings();
    webSettings.setJavaScriptEnabled(true);

    JavaScriptHandler jScriptHandler = new JavaScriptHandler(this); 
    WebChromeClient myWebChromeClient = new WebChromeClient();
    myWebView.setWebChromeClient(myWebChromeClient);
    myWebView.addJavascriptInterface(jScriptHandler, "MyHandler");

    myWebView.loadUrl("file:///android_asset/mywebpage.html");
    myWebView.loadUrl("javascript:myFunc()");


}
</code></pre>

<p>Here is the code for my JavaScriptHandler:</p>

<pre><code>public class JavaScriptHandler {
//TabFragmentMap mapFragment;
Context context;
//Fragment fragment;

public JavaScriptHandler (Context c){
    this.context = c;
}
</code></pre>

<p>}</p>

<p>Here is the code for my html:</p>

<pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;PhoneGap&lt;/title&gt;
&lt;/head&gt;
&lt;body onload="myFunc()"&gt;
&lt;h1 id="test1"&gt;Hello World&lt;/h1&gt;
&lt;input type="button" value="Say hello" onClick="moveMyself()" /&gt;
&lt;div id="myDiv"&gt;&lt;/div&gt;
&lt;script type="text/javascript"&gt; 


    function myFunc()
    {

       document.getElementById('test1').innerHTML = 'Good Morning';

    }

&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
