Can't Get The Url In The Should Over Overriding Webview
I am developing an android app, which has a webview in it.. The URL is https://www.facebook.com/ when the post is clicked in the webview the post URL is not getting in should overi
Solution 1:
Just using shouldOverrideUrlLoading
:
publicclassMyWebViewClientextendsWebViewClient {
@OverridepublicbooleanshouldOverrideUrlLoading(WebView view, String url) {
if (url.equals("YOURLINK")) {
Intentintent=newIntent(getContext(), YourActivity.class);
startActivity(intent);
returntrue; // Handle By application itself
} else {
view.loadUrl(url);
returntrue;
}
}
}
Solution 2:
For that you need to check and use WebViewClient.
By using WebViewClient, you can monior any action user makes with WebView. Now, as you want to detect URL click and want to start new activity based on it, check: shouldOverrideUrlLoading.
Check WebView page for the WebViewClient example.
Solution 3:
You must check up on http://developer.android.com/guide/webapps/webview.html address.
Post a Comment for "Can't Get The Url In The Should Over Overriding Webview"