Mahek Mahek - 1 year ago 94
Android Question

Link should be open in same web view in Android

I am new in Android and I am trying to open a Link in webview using this code

WebView myWebView = (WebView) findViewById(;

and in this HTML page contains some links and I want that when user click that link should be open in same webview,
at this point its opening in mobile browser, please give me appropriate solution..

Answer Source

You need to add WebViewClient to your WebView in order to open it in the WebView. Something like

    myWebView.setWebViewClient(new WebViewClient() {
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            return false;

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download