English | Site Directory

Android - An Open Handset Alliance Project

android.webkit
public class

android.webkit.WebChromeClient

java.lang.Object
android.webkit.WebChromeClient

Summary

Public Constructors

          WebChromeClient()

Public Methods

        void  onCloseWindow(WebView window)
Notify the host application to close the given WebView and remove it from the view system if necessary.
        boolean  onJsAlert(WebView view, String url, String message, JsResult result)
Tell the client to display a javascript alert dialog.
        boolean  onJsConfirm(WebView view, String url, String message, JsResult result)
Tell the client to display a confirm dialog to the user.
        boolean  onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result)
Tell the client to display a prompt dialog to the user.
        void  onProgressChanged(WebView view, int newProgress)
Tell the host application the current progress of loading a page.
        void  onReceivedIcon(WebView view, Bitmap icon)
Notify the host application of a new favicon for the current page.
        void  onReceivedTitle(WebView view, String title)
Notify the host application of a change in the document title.
        WebView  shouldCreateWindow(WebView view)
Request the host application to create a new Webview.
Methods inherited from class java.lang.Object

Details

Public Constructors

public WebChromeClient()

Public Methods

public void onCloseWindow(WebView window)

Notify the host application to close the given WebView and remove it from the view system if necessary. At this point, WebCore has stopped any loading in this window and has removed any cross-scripting ability in javascript.

Parameters

window The WebView that needs to be closed.

public boolean onJsAlert(WebView view, String url, String message, JsResult result)

Tell the client to display a javascript alert dialog. If the client returns true, WebView will assume that the client will handle the dialog. If the client returns false, it will continue execution.

Parameters

view The WebView that initiated the callback.
url The url of the page requesting the dialog.
message Message to be displayed in the window.
result A JsResult to confirm that the user hit enter.

Returns

  • boolean Whether the client will handle the alert dialog.

public boolean onJsConfirm(WebView view, String url, String message, JsResult result)

Tell the client to display a confirm dialog to the user. If the client returns true, WebView will assume that the client will handle the confirm dialog and call the appropriate JsConfirmResult method. If the client returns false, a default value of false will be returned to javascript. The default behavior is to return false.

Parameters

view The WebView that initiated the callback.
url The url of the page requesting the dialog.
message Message to be displayed in the window.
result A JsResult used to send the user's response to javascript.

Returns

  • boolean Whether the client will handle the confirm dialog.

public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result)

Tell the client to display a prompt dialog to the user. If the client returns true, WebView will assume that the client will handle the prompt dialog and call the appropriate JsPromptResult method. If the client returns false, a default value of false will be returned to to javascript. The default behavior is to return false.

Parameters

view The WebView that initiated the callback.
url The url of the page requesting the dialog.
message Message to be displayed in the window.
defaultValue The default value displayed in the prompt dialog.
result A JsPromptResult used to send the user's reponse to javascript.

Returns

  • boolean Whether the client will handle the prompt dialog.

public void onProgressChanged(WebView view, int newProgress)

Tell the host application the current progress of loading a page.

Parameters

view The WebView that initiated the callback.
newProgress Current page loading progress, represented by an integer between 0 and 100.

public void onReceivedIcon(WebView view, Bitmap icon)

Notify the host application of a new favicon for the current page.

Parameters

view The WebView that initiated the callback.
icon A Bitmap containing the favicon for the current page.

public void onReceivedTitle(WebView view, String title)

Notify the host application of a change in the document title.

Parameters

view The WebView that initiated the callback.
title A String containing the new title of the document.

public WebView shouldCreateWindow(WebView view)

Request the host application to create a new Webview. The host application should handle placement of the new WebView in the view system. The default behavior returns null.

Parameters

view The WebView that initiated the callback.

Returns

  • A new WebView or null if a sub-window was not created.
Build m5-rc15i - 10 Jun 2008 13:54