title: Android clicking a button inside a webview
body: <p>I'm trying to implement a button inside a webview, I'm using the following code :</p>
  
  <pre><code>package com.example.tests;
  
  import android.os.Bundle;
  import android.annotation.SuppressLint;
  import android.app.Activity;
  import android.util.Log;
  import android.view.Menu;
  import android.view.View;
  import android.view.Window;
  import android.webkit.JavascriptInterface;
  import android.webkit.WebSettings;
  import android.webkit.WebView;
  import android.webkit.WebViewClient;
  import android.widget.EditText;
  import android.widget.TextView;
  import android.widget.Toast;
  
  @SuppressLint("SetJavaScriptEnabled")
  public class Webview extends Activity {
  
     private WebView browser;
  
     @Override        
     protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        browser = (WebView)findViewById(R.id.webView1);
        browser.getSettings().setJavaScriptEnabled(true);
        browser.getSettings().setLoadsImagesAutomatically(true);
        browser.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
        browser.setWebViewClient(new MyBrowser());
        browser.loadUrl("file:///android_asset/index.html");
     }
  
  
     private class MyBrowser extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url); 
            view.addJavascriptInterface(new Object()
            {
                @JavascriptInterface
              public void performClick() throws Exception
              {
                  Log.d("LOGIN::", "Clicked");
                   Toast.makeText(Webview.this, "Login clicked", Toast.LENGTH_LONG).show();
              }
            }, "login");
           return true;
        }
     }
  
     @Override
     public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
     }
  
  }
  </code></pre>
  
  <p>As for the html page :</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script language="javascript"&gt;
  function js1() 
  {
  document.loginform.method="post";
  document.loginform.action = "https://example.com/chechlogin.asp";
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form name="loginform"&gt;
  &lt;input type="text" name="empcode" value="58686" /&gt;&lt;br/&gt;
  &lt;input type="password" name="emppassNTL" /&gt;
  &lt;input type="submit" name="submit" id="submit_id" onclick="btnLogin.performClick();" /&gt;
  </code></pre>
  
  <p>When clicking on the button a toast message should be shown, well it's not working, any help please ?</p>