Answers for "andorid studio webview app lik click new tab open stop"

0

andorid studio webview app lik click new tab open stop

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    String url ="http://dirtywasted.com/";
    WebView view=(WebView) this.findViewById(R.id.webView);
    view.getSettings().setJavaScriptEnabled(true);
    view.setWebViewClient(new WebViewClient() {
            @Override
            public bool shouldOverrideUrlLoading(WebView view, String url) {
                //url will be the url that you click in your webview.
                //you can open it with your own webview or do
                //whatever you want

                //Here is the example that you open it your own webview.
                view.loadUrl(url);
                return true;
            }       
         });
    view.loadUrl(url);
}
Posted by: Guest on September-06-2021

Browse Popular Code Answers by Language