title: How to dismiss alert dialog when javascript button is clicked in web-view in android
body: <p>Below is the code what i tried so far:</p>
  
  <pre><code>TextView tv =findViewById(R.id.tv);
  tv.setOnClickListener(new View.OnClickListener() {
      @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
      @Override
      public void onClick(View v) {
  
          Dialog dialog=new Dialog(MainActivity.this, android.R.style.Theme_Dialog);
          dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
          dialog.getWindow().setBackgroundDrawable(getDrawable(R.drawable.rounded_rect));
          dialog.setContentView(R.layout.dialog);
  
          WebView view =dialog.findViewById(R.id.webview);
          WebSettings webSettings = view.getSettings();
          webSettings.setJavaScriptEnabled(true);
  
          view.loadUrl("https://www.journaldev.com");
          dialog.show();
      }
  });
  }
  </code></pre>
  
  <p>Any help is appreciated!</p>
  
  <p>My requirement is load web-view in alert dialog and web-view has one java script button called "close" on click of close button inside web-view alert dialog should be dismissed.</p>
  
  <p>How to achieve this in android?</p>