I'm using WebViewClient. Should we be seeing onPageStarted() callbacks always paired with an shouldOverrideUrlLoading() callback? If I load example.com in my WebView, should we be seeing both methods get called back? From the docs:
onPageStarted()
Notify the host application that a page has started loading. This method is called once for each main frame load so a page with iframes or framesets will call onPageStarted one time for the main frame. This also means that onPageStarted will not be called when the contents of an embedded frame changes, i.e. clicking a link whose target is an iframe.
shouldOverrideUrlLoading()
Give the host application a chance to take over the control when a new url is about to be loaded in the current WebView. If WebViewClient is not provided, by default WebView will ask Activity Manager to choose the proper handler for the url. If WebViewClient is provided, return true means the host application handles the url, while return false means the current WebView handles the url.
I'm put a log statement in each method, and I see that they're not always paired together. In what cases would they not be?
Thanks
http://developer.android.com/reference/android/webkit/WebViewClient.html
shouldOverrideUrlLoading()
thenonPageStarted()
will not get called. Beyond that, it might be possible thatonPageStart
will sometimes not get called if there are two requests back to back, thus potentially preventing one of them from going through. I'm not so confident about the latter, though. – ReedshouldOverrideUrlLoading
andonPageStarted
can be called in any order, which is very confusing. I didn't yet find out at which circumstances this happens. – Stan