Pavya
Pavya

Reputation: 6025

How to get current url from webview?

I am developing an android application in which I am using Webview object. I am sending an url and couple parameters to Webview object. Please check below line.

String url = "www.myurl.com";
webView.postUrl(url,EncodingUtils.getBytes(postStr, "utf-8"));

For now, I can see my url in webview. This url has couple submission functionality, At the end of scenario, it sends me to success url. But I am not getting that url pro-grammatically. I have used To get that url using below function of webview.

@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    view.loadUrl(url);
} 

It's working for earlier urls but its not getting for final url.

How to do that?

Upvotes: 1

Views: 2173

Answers (2)

Mateuszprogrammer1302
Mateuszprogrammer1302

Reputation: 202

webView.loadUrl("THE URL");

Upvotes: 0

Taylor Frey
Taylor Frey

Reputation: 374

@SagarP is correct. webView.getUrl() will return the URL according to the WebView Documentation

Upvotes: 2

Related Questions