Reputation: 1532
In iPhone we have functions like webViewDidStartLoad and webViewDidFinishLoad to check the Start of loading and finish of particular url.
Do we have anythng like this on Android ?
Upvotes: 0
Views: 185
Reputation: 5803
You could try something like this :
webView.setWebViewClient(new WebViewClient() {
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
// Do something here
}
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
// Do something here
}
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
super.onReceivedError(view, errorCode, description, failingUrl);
// Do something here
}
});
Upvotes: 1
Reputation: 1703
Yes you can use WebViewClient :
private class CustomWebClient extends WebViewClient{
public void onPageStarted(WebView view, String url, Bitmap favicon)
{
}
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl)
{
}
public void onPageFinished(WebView view, String url)
{
}
}
Usage:
webView.setWebViewClient(new CustomWebClient());
Every method name is self explanatory and you can also check this : http://developer.android.com/reference/android/webkit/WebViewClient.html
Upvotes: 1