Fields Summary |
---|
public static final int | ERROR_UNKNOWNGeneric error |
public static final int | ERROR_HOST_LOOKUPServer or proxy hostname lookup failed |
public static final int | ERROR_UNSUPPORTED_AUTH_SCHEMEUnsupported authentication scheme (not basic or digest) |
public static final int | ERROR_AUTHENTICATIONUser authentication failed on server |
public static final int | ERROR_PROXY_AUTHENTICATIONUser authentication failed on proxy |
public static final int | ERROR_CONNECTFailed to connect to the server |
public static final int | ERROR_IOFailed to read or write to the server |
public static final int | ERROR_TIMEOUTConnection timed out |
public static final int | ERROR_REDIRECT_LOOPToo many redirects |
public static final int | ERROR_UNSUPPORTED_SCHEMEUnsupported URI scheme |
public static final int | ERROR_FAILED_SSL_HANDSHAKEFailed to perform SSL handshake |
public static final int | ERROR_BAD_URLMalformed URL |
public static final int | ERROR_FILEGeneric file error |
public static final int | ERROR_FILE_NOT_FOUNDFile not found |
public static final int | ERROR_TOO_MANY_REQUESTSToo many requests during this load |
Methods Summary |
---|
public void | doUpdateVisitedHistory(WebView view, java.lang.String url, boolean isReload)Notify the host application to update its visited links database.
|
public void | onFormResubmission(WebView view, android.os.Message dontResend, android.os.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.
dontResend.sendToTarget();
|
public void | onLoadResource(WebView view, java.lang.String url)Notify the host application that the WebView will load the resource
specified by the given url.
|
public void | onPageFinished(WebView view, java.lang.String url)Notify the host application that a page has finished loading. This method
is called only for main frame. When onPageFinished() is called, the
rendering picture may not be updated yet. To get the notification for the
new Picture, use {@link WebView.PictureListener#onNewPicture}.
|
public void | onPageStarted(WebView view, java.lang.String url, android.graphics.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.
|
public void | onReceivedClientCertRequest(WebView view, ClientCertRequest request)Notify the host application to handle a SSL client certificate
request. The host application is responsible for showing the UI
if desired and providing the keys. There are three ways to
respond: proceed(), cancel() or ignore(). Webview remembers the
response if proceed() or cancel() is called and does not
call onReceivedClientCertRequest() again for the same host and port
pair. Webview does not remember the response if ignore() is called.
This method is called on the UI thread. During the callback, the
connection is suspended.
The default behavior is to cancel, returning no client certificate.
request.cancel();
|
public void | onReceivedError(WebView view, int errorCode, java.lang.String description, java.lang.String failingUrl)Report an error to the host application. These errors are unrecoverable
(i.e. the main resource is unavailable). The errorCode parameter
corresponds to one of the ERROR_* constants.
|
public void | onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, java.lang.String host, java.lang.String realm)Notifies the host application that the WebView received an HTTP
authentication request. The host application can use the supplied
{@link HttpAuthHandler} to set the WebView's response to the request.
The default behavior is to cancel the request.
handler.cancel();
|
public void | onReceivedLoginRequest(WebView view, java.lang.String realm, java.lang.String account, java.lang.String args)Notify the host application that a request to automatically log in the
user has been processed.
|
public void | onReceivedSslError(WebView view, SslErrorHandler handler, android.net.http.SslError error)Notify the host application that an SSL error occurred while loading a
resource. The host application must call either handler.cancel() or
handler.proceed(). Note that the decision may be retained for use in
response to future SSL errors. The default behavior is to cancel the
load.
handler.cancel();
|
public void | onScaleChanged(WebView view, float oldScale, float newScale)Notify the host application that the scale applied to the WebView has
changed.
|
public void | onTooManyRedirects(WebView view, android.os.Message cancelMsg, android.os.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.
cancelMsg.sendToTarget();
|
public void | onUnhandledInputEvent(WebView view, android.view.InputEvent event)Notify the host application that a input event was not handled by the WebView.
Except system keys, WebView always consumes input events in the normal flow
or if shouldOverrideKeyEvent returns true. This is called asynchronously
from where the event is dispatched. It gives the host application a chance
to handle the unhandled input events.
Note that if the event is a {@link android.view.MotionEvent}, then it's lifetime is only
that of the function call. If the WebViewClient wishes to use the event beyond that, then it
must create a copy of the event.
It is the responsibility of overriders of this method to call
{@link #onUnhandledKeyEvent(WebView, KeyEvent)}
when appropriate if they wish to continue receiving events through it.
if (event instanceof KeyEvent) {
onUnhandledKeyEvent(view, (KeyEvent) event);
return;
}
onUnhandledInputEventInternal(view, event);
|
private void | onUnhandledInputEventInternal(WebView view, android.view.InputEvent event)
ViewRootImpl root = view.getViewRootImpl();
if (root != null) {
root.dispatchUnhandledInputEvent(event);
}
|
public void | onUnhandledKeyEvent(WebView view, android.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 a chance
to handle the unhandled key events.
onUnhandledInputEventInternal(view, event);
|
public WebResourceResponse | shouldInterceptRequest(WebView view, java.lang.String url)Notify the host application of a resource request and allow the
application to return the data. If the return value is null, the WebView
will continue to load the resource as usual. Otherwise, the return
response and data will be used. NOTE: This method is called on a thread
other than the UI thread so clients should exercise caution
when accessing private data or the view system.
return null;
|
public WebResourceResponse | shouldInterceptRequest(WebView view, WebResourceRequest request)Notify the host application of a resource request and allow the
application to return the data. If the return value is null, the WebView
will continue to load the resource as usual. Otherwise, the return
response and data will be used. NOTE: This method is called on a thread
other than the UI thread so clients should exercise caution
when accessing private data or the view system.
return shouldInterceptRequest(view, request.getUrl().toString());
|
public boolean | shouldOverrideKeyEvent(WebView view, android.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.
return false;
|
public boolean | shouldOverrideUrlLoading(WebView view, java.lang.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. 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.
This method is not called for requests using the POST "method".
return false;
|