Android
android.webkit
public class

android.webkit.WebViewClient

java.lang.Object
android.webkit.WebViewClient

Summary

Public Constructors

            WebViewClient()

Public Methods

          void  doUpdateVisitedHistory(WebView view, String url, boolean isReload)
Notify the host application to update its visited links database.
          void  onFormResubmission(WebView view, Message dontResend, Message resend)
As the host application if the browser should resend data as the requested page was a result of a POST.
          void  onLoadResource(WebView view, String url)
Notify the host application that the WebView will load the resource specified by the given url.
          void  onPageFinished(WebView view, String url)
Notify the host application that a page has finished loading.
          void  onPageStarted(WebView view, String url, Bitmap favicon)
Notify the host application that a page has started loading.
          void  onReceivedError(WebView view, int errorCode, String description, String failingUrl)
Report an error to an activity.
          void  onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host, String realm)
Notify the host application to handle an authentication request.
          void  onScaleChanged(WebView view, float oldScale, float newScale)
Notify the host application that the scale applied to the WebView has changed.
          void  onTooManyRedirects(WebView view, Message cancelMsg, Message continueMsg)
Notify the host application that there have been an excessive number of HTTP redirects.
          void  onUnhandledKeyEvent(WebView view, KeyEvent event)
Notify the host application that a key was not handled by the WebView.
          boolean  shouldOverrideKeyEvent(WebView view, KeyEvent event)
Give the host application a chance to handle the key event synchronously.
          boolean  shouldOverrideUrlLoading(WebView view, String url)
Give the host application a chance to take over the control when a new url is about to be loaded in the current WebView.
Methods inherited from class java.lang.Object

Details

Public Constructors

public WebViewClient()

Public Methods

public void doUpdateVisitedHistory(WebView view, String url, boolean isReload)

Notify the host application to update its visited links database.

Parameters

view The WebView that is initiating the callback.
url The url being visited.
isReload True if this url is being reloaded.

public void onFormResubmission(WebView view, Message dontResend, Message resend)

As the host application if the browser should resend data as the requested page was a result of a POST. The default is to not resend the data.

Parameters

view The WebView that is initiating the callback.
dontResend The message to send if the browser should not resend
resend The message to send if the browser should resend data

public void onLoadResource(WebView view, String url)

Notify the host application that the WebView will load the resource specified by the given url.

Parameters

view The WebView that is initiating the callback.
url The url of the resource the WebView will load.

public void onPageFinished(WebView view, String url)

Notify the host application that a page has finished loading. This method is called only for main frame.

Parameters

view The WebView that is initiating the callback.
url The url of the page.

public void onPageStarted(WebView view, String url, Bitmap favicon)

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.

Parameters

view The WebView that is initiating the callback.
url The url to be loaded.
favicon The favicon for this page if it already exists in the database.

public void onReceivedError(WebView view, int errorCode, String description, String failingUrl)

Report an error to an activity. These errors come up from WebCore, and are network errors.

Parameters

view The WebView that is initiating the callback.
errorCode The HTTP error code.
description A String description.
failingUrl The url that failed.

public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host, String realm)

Notify the host application to handle an authentication request. The default behavior is to cancel the request.

Parameters

view The WebView that is initiating the callback.
handler The HttpAuthHandler that will handle the user's response.
host The host requiring authentication.
realm A description to help store user credentials for future visits.

public void onScaleChanged(WebView view, float oldScale, float newScale)

Notify the host application that the scale applied to the WebView has changed.

Parameters

view he WebView that is initiating the callback.
oldScale The old scale factor
newScale The new scale factor

public void onTooManyRedirects(WebView view, Message cancelMsg, Message continueMsg)

Notify the host application that there have been an excessive number of HTTP redirects. As the host application if it would like to continue trying to load the resource. The default behavior is to send the cancel message.

Parameters

view The WebView that is initiating the callback.
cancelMsg The message to send if the host wants to cancel
continueMsg The message to send if the host wants to continue

public void onUnhandledKeyEvent(WebView view, KeyEvent event)

Notify the host application that a key was not handled by the WebView. Except system keys, WebView always consumes the keys in the normal flow or if shouldOverrideKeyEvent returns true. This is called asynchronously from where the key is dispatched. It gives the host application an chance to handle the unhandled key events.

Parameters

view The WebView that is initiating the callback.
event The key event.

public boolean shouldOverrideKeyEvent(WebView view, KeyEvent event)

Give the host application a chance to handle the key event synchronously. e.g. menu shortcut key events need to be filtered this way. If return true, WebView will not handle the key event. If return false, WebView will always handle the key event, so none of the super in the view chain will see the key event. The default behavior returns false.

Parameters

view The WebView that is initiating the callback.
event The key event.

Returns

  • True if the host application wants to handle the key event itself, otherwise return false

public boolean shouldOverrideUrlLoading(WebView view, String url)

Give the host application a chance to take over the control when a new url is about to be loaded in the current WebView. The default behavior is false.

Parameters

view The WebView that is initiating the callback.
url The url to be loaded.

Returns

  • True if the host application wants to leave the current WebView and handle the url itself, otherwise return false.
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56