i am trying to call a java method in androind activity from html button, loaded in webView but when i click the buton nothing happens. Here is the code i have tried
Here is the html code
<button onClick="activity.TestMethod();">Call Java Activity Method</button>
Here is the android activity method
public void TestMethod()
{
Toast.makeText(getApplicationContext(), "this is my Toast message!!! =)",
Toast.LENGTH_LONG).show();
}
I have enabled JavaScript by using
WebView index = (WebView) findViewById(R.id.webView1);
WebSettings webSettings = index.getSettings();
webSettings.setJavaScriptEnabled(true);
index.loadUrl("file:///android_asset/index.html");