I am trying to create an android app which will show multiple web urls to users based on their choice. If a user clicks on a link I want the external website to open inside my app so that user can easily go back to other links after visiting the side. I am using web view and each time it is opening a browser , which I don't want. As sometimes it is difficult for user to go back to app. I want something like a web page opening inside a frame .
I am using the following code in my activity.
webView = (WebView) findViewById(R.id.webview);
webView.loadUrl(url);
Thanks in advance for any help . Shakti
Yes then you need to create WebViewClient.
private class HelloWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
}
Check Step No. 7 and 8 given in Hello WebView example..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With