Build 1.0_r1(from source)

android.webkit
Class WebView

java.lang.Object
  extended by android.view.View
      extended by android.view.ViewGroup
          extended by android.widget.AbsoluteLayout
              extended by android.webkit.WebView
All Implemented Interfaces:
Drawable.Callback, KeyEvent.Callback, ViewGroup.OnHierarchyChangeListener, ViewManager, ViewParent, ViewTreeObserver.OnGlobalFocusChangeListener

public class WebView
extends AbsoluteLayout
implements ViewTreeObserver.OnGlobalFocusChangeListener, ViewGroup.OnHierarchyChangeListener

A View that displays web pages. This class is the basis upon which you can roll your own web browser or simply display some online content within your Activity. It uses the WebKit rendering engine to display web pages and includes methods to navigate forward and backward through a history, zoom in and out, perform text searches and more.

Note that, in order for your Activity to access the Internet and load web pages in a WebView, you must add the INTERNET permissions to your Android Manifest file:

<uses-permission android:name="android.permission.INTERNET" />

This must be a child of the <manifest> element.


Nested Class Summary
 class WebView.HitTestResult
           
static interface WebView.PictureListener
          Interface to listen for new pictures as they change.
(package private)  class WebView.PrivateHandler
          General handler to receive message coming from webkit thread
 class WebView.WebViewTransport
          Transportation object for returning WebView across thread boundaries.
 
Nested classes/interfaces inherited from class android.widget.AbsoluteLayout
AbsoluteLayout.LayoutParams
 
Nested classes/interfaces inherited from class android.view.ViewGroup
ViewGroup.MarginLayoutParams, ViewGroup.OnHierarchyChangeListener
 
Nested classes/interfaces inherited from class android.view.View
View.BaseSavedState, View.MeasureSpec, View.OnClickListener, View.OnCreateContextMenuListener, View.OnFocusChangeListener, View.OnKeyListener, View.OnLongClickListener, View.OnTouchListener
 
Field Summary
(package private) static boolean DEBUG
           
(package private) static int DID_FIRST_LAYOUT_MSG_ID
           
(package private) static String LOGTAG
           
(package private) static boolean LOGV_ENABLED
           
(package private) static int LONG_PRESS_TRACKBALL
           
(package private) static int MARK_NODE_INVALID_ID
           
(package private)  boolean mHeightCanMeasure
           
(package private)  int mLastHeightSent
           
(package private)  int mLastWidthSent
           
(package private)  Handler mPrivateHandler
           
(package private)  VelocityTracker mVelocityTracker
          Helper class to get velocity for fling
(package private)  boolean mWidthCanMeasure
          These prevent calling requestLayout if either dimension is fixed.
(package private) static int NEW_PICTURE_MSG_ID
           
(package private) static int NOTIFY_FOCUS_SET_MSG_ID
           
(package private) static int RECOMPUTE_FOCUS_MSG_ID
           
static String SCHEME_GEO
          URI scheme for map address
static String SCHEME_MAILTO
          URI scheme for email address
static String SCHEME_TEL
          URI scheme for telephone number
(package private) static int SCROLL_BY_MSG_ID
           
(package private) static int SCROLL_TO_MSG_ID
           
(package private) static int SPAWN_SCROLL_TO_MSG_ID
           
(package private) static int SYNC_SCROLL_TO_MSG_ID
           
(package private) static int UPDATE_CLIPBOARD
           
(package private) static int UPDATE_TEXT_ENTRY_MSG_ID
           
(package private) static int UPDATE_TEXTFIELD_TEXT_MSG_ID
           
(package private) static int WEBCORE_INITIALIZED_MSG_ID
           
(package private) static int ZOOM_OUT_WIDTH
           
 
Fields inherited from class android.view.ViewGroup
CLIP_TO_PADDING_MASK, FLAG_SUPPORT_STATIC_TRANSFORMATIONS, FLAG_USE_CHILD_DRAWING_ORDER, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, mDisappearingChildren, mGroupFlags, mOnHierarchyChangeListener, mPersistentDrawingCache, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHE
 
Fields inherited from class android.view.View
DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FIRST_STATE_SET, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, INVISIBLE, KEEP_SCREEN_ON, LAST_STATE_SET, mBottom, mContext, mCurrentAnimation, MIDDLE_STATE_SET, mLayoutParams, mLeft, mLocation, mMeasuredHeight, mMeasuredWidth, mOnClickListener, mOnCreateContextMenuListener, mOnFocusChangeListener, mOnLongClickListener, mPaddingBottom, mPaddingLeft, mPaddingRight, mPaddingTop, mParent, mRight, mScrollX, mScrollY, mTag, mTop, NO_ID, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FIRST_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_LAST_STATE_SET, PRESSED_MIDDLE_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_SINGLE_STATE_SET, PRESSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SINGLE_STATE_SET, SOUND_EFFECTS_ENABLED, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET
 
Constructor Summary
WebView(Context context)
          Construct a new WebView with a Context object.
WebView(Context context, AttributeSet attrs)
          Construct a new WebView with layout parameters.
WebView(Context context, AttributeSet attrs, int defStyle)
          Construct a new WebView with layout parameters and a default style.
 
Method Summary
 void addJavascriptInterface(Object obj, String interfaceName)
          Use this function to bind an object to Javascript so that the methods can be accessed from Javascript.
 boolean canGoBack()
          Return true if this WebView has a back history item.
 boolean canGoBackOrForward(int steps)
          Return true if the page can go back or forward the given number of steps.
 boolean canGoForward()
          Return true if this WebView has a forward history item.
 Picture capturePicture()
          Return a new picture that captures the current display of the webview.
 void clearCache(boolean includeDiskFiles)
          Clear the resource cache.
 void clearFormData()
          Make sure that clearing the form data removes the adapter from the currently focused textfield if there is one.
 void clearHistory()
          Tell the WebView to clear its internal back/forward list.
 void clearSslPreferences()
          Clear the SSL preferences table stored in response to proceeding with SSL certificate errors.
 void clearView()
          Clear the view so that onDraw() will draw nothing but white background, and onMeasure() will return 0 if MeasureSpec is not MeasureSpec.EXACTLY
protected  int computeHorizontalScrollRange()
          Compute the horizontal range that the horizontal scrollbar represents.
 void computeScroll()
          Called by a parent to request that a child update its values for mScrollX and mScrollY if necessary.
protected  int computeVerticalScrollRange()
          Compute the vertical range that the vertical scrollbar represents.
 WebBackForwardList copyBackForwardList()
          Return the WebBackForwardList for this WebView.
 void debugDump()
           
(package private)  void deleteSelection(int start, int end)
          Delete text from start to end in the focused textfield.
 void destroy()
          Destroy the internal state of the WebView.
static void disablePlatformNotifications()
          If platform notifications are enabled, this should be called from onPause() or onStop().
 boolean dispatchKeyEvent(KeyEvent event)
          Dispatch a key event to the next view on the focus path.
 void documentAsText(Message callback)
          
 void documentHasImages(Message response)
          Query the document to see if it contains any image references.
(package private)  boolean drawHistory()
           
static void enablePlatformNotifications()
          Enables platform notifications of data state and proxy changes.
 void externalRepresentation(Message callback)
          
protected  void finalize()
          Called by the virtual machine when there are no longer any (non-weak) references to the receiver.
static String findAddress(String addr)
          Return the first substring consisting of the address of a physical location.
 void flingScroll(int vx, int vy)
           
 SslCertificate getCertificate()
           
 int getContentHeight()
           
 Bitmap getFavicon()
          Get the favicon for the current page.
 WebView.HitTestResult getHitTestResult()
          Return a HitTestResult based on the current focus node.
 String[] getHttpAuthUsernamePassword(String host, String realm)
          Retrieve the HTTP authentication username and password for a given host & realm pair
static PluginList getPluginList()
          Return the list of currently loaded plugins.
 int getProgress()
          Get the progress for the current page.
 float getScale()
          Return the current scale of the WebView
 WebSettings getSettings()
          Return the WebSettings object used to control the settings for this WebView.
 String getTitle()
          Get the title for the current page.
 String getUrl()
          Get the url for the current page.
(package private)  WebViewCore getWebViewCore()
           
 View getZoomControls()
          Returns a view containing zoom controls i.e.
 void goBack()
          Go back in the history of this WebView.
 void goBackOrForward(int steps)
          Go to the history item that is the number of steps away from the current item.
 void goForward()
          Go forward in the history of this WebView.
 void invokeZoomPicker()
          Invoke the graphical zoom picker widget for this WebView.
 void loadData(String data, String mimeType, String encoding)
          Load the given data into the WebView.
 void loadDataWithBaseURL(String baseUrl, String data, String mimeType, String encoding, String failUrl)
          Load the given data into the WebView, use the provided URL as the base URL for the content.
 void loadUrl(String url)
          Load the given url.
(package private)  void moveSelection(float xRate, float yRate)
           
protected  void onAttachedToWindow()
          This is called when the view is attached to a window.
 void onChildViewAdded(View parent, View child)
          Called when a new child is added to a parent view.
 void onChildViewRemoved(View p, View child)
          Called when a child is removed from a parent view.
protected  void onDetachedFromWindow()
          This is called when the view is detached from a window.
protected  void onDraw(Canvas canvas)
          Implement this to do your drawing.
protected  void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect)
          Called by the view system when the focus state of this view changes.
 void onGlobalFocusChanged(View oldFocus, View newFocus)
          Callback method to be invoked when the focus changes in the view tree.
 boolean onKeyDown(int keyCode, KeyEvent event)
          Default implementation of KeyEvent.Callback.onKeyMultiple(): perform press of the view when KeyEvent.KEYCODE_DPAD_CENTER or KeyEvent.KEYCODE_ENTER is released, if the view is enabled and clickable.
 boolean onKeyUp(int keyCode, KeyEvent event)
          Default implementation of KeyEvent.Callback.onKeyMultiple(): perform clicking of the view when KeyEvent.KEYCODE_DPAD_CENTER or KeyEvent.KEYCODE_ENTER is released.
protected  void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
           Measure the view and its content to determine the measured width and the measured height.
(package private)  boolean onSavePassword(String host, String username, String password, Message resumeMsg)
           
protected  void onScrollChanged(int l, int t, int oldl, int oldt)
          This is called in response to an internal scroll in this view (i.e., the view scrolled its own contents).
protected  void onSizeChanged(int w, int h, int ow, int oh)
          This is called during layout when the size of this view has changed.
 boolean onTouchEvent(MotionEvent ev)
          Implement this method to handle touch screen motion events.
 boolean onTrackballEvent(MotionEvent ev)
          Implement this method to handle trackball motion events.
 void onWindowFocusChanged(boolean hasWindowFocus)
          Called when the window containing this view gains or loses focus.
 boolean overlayHorizontalScrollbar()
          Return whether horizontal scrollbar has overlay style
 boolean overlayVerticalScrollbar()
          Return whether vertical scrollbar has overlay style
 boolean pageDown(boolean bottom)
          Scroll the contents of the view down by half the page size
 boolean pageUp(boolean top)
          Scroll the contents of the view up by half the view size
(package private)  void passToJavaScript(String currentText, KeyEvent event)
           
 void pauseTimers()
          Pause all layout, parsing, and javascript timers.
 boolean performLongClick()
          Call this view's OnLongClickListener, if it is defined.
 void refreshPlugins(boolean reloadOpenPages)
          Signal the WebCore thread to refresh its list of plugins.
 void reload()
          Reload the current url.
(package private)  void replaceTextfieldText(int oldStart, int oldEnd, String replace, int newStart, int newEnd)
           
 boolean requestChildRectangleOnScreen(View child, Rect rect, boolean immediate)
          Called when a child of this group wants a particular rectangle to be positioned onto the screen.
 boolean requestFocus(int direction, Rect previouslyFocusedRect)
          Call this to try to give focus to a specific view or to one of its descendants and give it hints about the direction and a specific rectangle that the focus is coming from.
 void requestFocusNodeHref(Message hrefMsg)
          Request the href of an anchor element due to getFocusNodePath returning "href." If hrefMsg is null, this method returns immediately and does not dispatch hrefMsg to its target.
 void requestImageRef(Message msg)
          Request the url of the image last touched by the user.
(package private)  void requestListBox(String[] array, boolean[] enabledArray, int selection)
           
(package private)  void requestListBox(String[] array, boolean[] enabledArray, int[] selectedArray)
           
(package private)  void resetTrackballTime()
           
 WebBackForwardList restoreState(Bundle inState)
          Restore the state of this WebView from the given map used in Activity.onThaw.
 void resumeTimers()
          Resume all layout, parsing, and javascript timers.
 void savePassword(String host, String username, String password)
          Save the username and password for a particular host in the WebView's internal database.
 WebBackForwardList saveState(Bundle outState)
          Save the state of this WebView used in Activity.onSaveInstanceState.
 void setBackgroundColor(int color)
          Set the background color.
 void setCertificate(SslCertificate certificate)
          Sets the SSL certificate for the main top-level page.
 void setDownloadListener(DownloadListener listener)
          Register the interface to be used when content can not be handled by the rendering engine, and should be downloaded instead.
 void setHorizontalScrollbarOverlay(boolean overlay)
          Specify whether the horizontal scrollbar has overlay style.
 void setHttpAuthUsernamePassword(String host, String realm, String username, String password)
          Set the HTTP authentication credentials for a given host and realm.
 void setInitialScale(int scaleInPercent)
          Set the initial scale for the WebView.
 void setLayoutParams(ViewGroup.LayoutParams params)
          Set the layout parameters associated with this view.
 void setMapTrackballToArrowKeys(boolean setMap)
           
 void setPictureListener(WebView.PictureListener listener)
          Set the Picture listener.
 void setScrollBarStyle(int style)
          Specify the style of the scrollbars.
(package private)  void setSelection(int start, int end)
          Set the selection to (start, end) in the focused textfield.
 void setVerticalScrollbarOverlay(boolean overlay)
          Specify whether the vertical scrollbar has overlay style.
 void setWebChromeClient(WebChromeClient client)
          Set the chrome handler.
 void setWebViewClient(WebViewClient client)
          Set the WebViewClient that will receive various notifications and requests.
(package private)  void shortPressOnTextField()
           
 void stopLoading()
          Stop the current load.
(package private)  void switchOutDrawHistory()
           
(package private)  void updateCachedTextfield(String updatedText)
          Update our cache with updatedText.
(package private)  int viewToContent(int x)
           
 boolean zoomIn()
          Perform zoom in in the webview
 boolean zoomOut()
          Perform zoom out in the webview
 
Methods inherited from class android.widget.AbsoluteLayout
checkLayoutParams, generateDefaultLayoutParams, generateLayoutParams, generateLayoutParams, onLayout
 
Methods inherited from class android.view.ViewGroup
addFocusables, addStatesFromChildren, addTouchables, addView, addView, addView, addView, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, canAnimate, childDrawableStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchDraw, dispatchFreezeSelfOnly, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetPressed, dispatchSetSelected, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchWindowFocusChanged, dispatchWindowVisibilityChanged, drawableStateChanged, drawChild, findFocus, findViewTraversal, findViewWithTagTraversal, fitSystemWindows, focusableViewAvailable, focusSearch, gatherTransparentRegion, getChildAt, getChildCount, getChildDrawingOrder, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getPersistentDrawingCache, hasFocus, hasFocusable, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawnWithCacheEnabled, measureChild, measureChildren, measureChildWithMargins, offsetChildrenTopAndBottom, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAnimationEnd, onAnimationStart, onCreateDrawableState, onInterceptTouchEvent, onRequestFocusInDescendants, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeDetachedView, removeView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestDisallowInterceptTouchEvent, requestTransparentRegion, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setOnHierarchyChangeListener, setPadding, setPersistentDrawingCache, showContextMenuForChild, startLayoutAnimation, updateViewLayout
 
Methods inherited from class android.view.View
applyDrawableToTransparentRegion, bringToFront, buildDrawingCache, cancelLongPress, clearAnimation, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeVerticalScrollExtent, computeVerticalScrollOffset, createContextMenu, debug, debugIndent, destroyDrawingCache, dispatchKeyShortcutEvent, draw, findViewById, findViewWithTag, focusSearch, forceLayout, getAnimation, getApplicationWindowToken, getBackground, getBaseline, getBottom, getBottomFadingEdgeStrength, getContext, getContextMenuInfo, getDefaultSize, getDrawableState, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFocusables, getFocusedRect, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getKeepScreenOn, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMeasuredHeight, getMeasuredWidth, getNextFocusDownId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getParent, getResources, getRight, getRightFadingEdgeStrength, getRootView, getScrollBarStyle, getScrollX, getScrollY, getSolidColor, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getTag, getTop, getTopFadingEdgeStrength, getTouchables, getTouchDelegate, getVerticalFadingEdgeLength, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowToken, getWindowVisibility, hasWindowFocus, inflate, initializeFadingEdge, initializeScrollbars, invalidate, invalidate, invalidate, invalidateDrawable, isClickable, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isInTouchMode, isLayoutRequested, isLongClickable, isPressed, isRootNamespace, isSaveEnabled, isSelected, isShown, isSoundEffectsEnabled, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, layout, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onCreateContextMenu, onFinishInflate, onKeyMultiple, onKeyShortcut, onRestoreInstanceState, onSaveInstanceState, onSetAlpha, onWindowVisibilityChanged, performClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, refreshDrawableState, removeCallbacks, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestRectangleOnScreen, requestRectangleOnScreen, resolveSize, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, setAnimation, setBackgroundDrawable, setBackgroundResource, setClickable, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setEnabled, setFadingEdgeLength, setFocusable, setFocusableInTouchMode, setFrame, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setId, setIsRootNamespace, setKeepScreenOn, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnClickListener, setOnCreateContextMenuListener, setOnFocusChangeListener, setOnKeyListener, setOnLongClickListener, setOnTouchListener, setPressed, setSaveEnabled, setSelected, setSoundEffectsEnabled, setTag, setTouchDelegate, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVisibility, setWillNotCacheDrawing, setWillNotDraw, showContextMenu, startAnimation, unscheduleDrawable, unscheduleDrawable, verifyDrawable, willNotCacheDrawing, willNotDraw
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface android.view.ViewParent
createContextMenu, getParent, isLayoutRequested, requestLayout
 

Field Detail

LOGTAG

static final String LOGTAG
See Also:
Constant Field Values

DEBUG

static final boolean DEBUG
See Also:
Constant Field Values

LOGV_ENABLED

static final boolean LOGV_ENABLED
See Also:
Constant Field Values

mPrivateHandler

final Handler mPrivateHandler

mVelocityTracker

VelocityTracker mVelocityTracker
Helper class to get velocity for fling


mWidthCanMeasure

boolean mWidthCanMeasure
These prevent calling requestLayout if either dimension is fixed. This depends on the layout parameters and the measure specs.


mHeightCanMeasure

boolean mHeightCanMeasure

mLastWidthSent

int mLastWidthSent

mLastHeightSent

int mLastHeightSent

SCROLL_TO_MSG_ID

static final int SCROLL_TO_MSG_ID
See Also:
Constant Field Values

SCROLL_BY_MSG_ID

static final int SCROLL_BY_MSG_ID
See Also:
Constant Field Values

SPAWN_SCROLL_TO_MSG_ID

static final int SPAWN_SCROLL_TO_MSG_ID
See Also:
Constant Field Values

SYNC_SCROLL_TO_MSG_ID

static final int SYNC_SCROLL_TO_MSG_ID
See Also:
Constant Field Values

NEW_PICTURE_MSG_ID

static final int NEW_PICTURE_MSG_ID
See Also:
Constant Field Values

UPDATE_TEXT_ENTRY_MSG_ID

static final int UPDATE_TEXT_ENTRY_MSG_ID
See Also:
Constant Field Values

WEBCORE_INITIALIZED_MSG_ID

static final int WEBCORE_INITIALIZED_MSG_ID
See Also:
Constant Field Values

UPDATE_TEXTFIELD_TEXT_MSG_ID

static final int UPDATE_TEXTFIELD_TEXT_MSG_ID
See Also:
Constant Field Values

DID_FIRST_LAYOUT_MSG_ID

static final int DID_FIRST_LAYOUT_MSG_ID
See Also:
Constant Field Values

RECOMPUTE_FOCUS_MSG_ID

static final int RECOMPUTE_FOCUS_MSG_ID
See Also:
Constant Field Values

NOTIFY_FOCUS_SET_MSG_ID

static final int NOTIFY_FOCUS_SET_MSG_ID
See Also:
Constant Field Values

MARK_NODE_INVALID_ID

static final int MARK_NODE_INVALID_ID
See Also:
Constant Field Values

UPDATE_CLIPBOARD

static final int UPDATE_CLIPBOARD
See Also:
Constant Field Values

LONG_PRESS_TRACKBALL

static final int LONG_PRESS_TRACKBALL
See Also:
Constant Field Values

ZOOM_OUT_WIDTH

static final int ZOOM_OUT_WIDTH
See Also:
Constant Field Values

SCHEME_TEL

public static final String SCHEME_TEL
URI scheme for telephone number

See Also:
Constant Field Values

SCHEME_MAILTO

public static final String SCHEME_MAILTO
URI scheme for email address

See Also:
Constant Field Values

SCHEME_GEO

public static final String SCHEME_GEO
URI scheme for map address

See Also:
Constant Field Values
Constructor Detail

WebView

public WebView(Context context)
Construct a new WebView with a Context object.

Parameters:
context - A Context object used to access application assets.

WebView

public WebView(Context context,
               AttributeSet attrs)
Construct a new WebView with layout parameters.

Parameters:
context - A Context object used to access application assets.
attrs - An AttributeSet passed to our parent.

WebView

public WebView(Context context,
               AttributeSet attrs,
               int defStyle)
Construct a new WebView with layout parameters and a default style.

Parameters:
context - A Context object used to access application assets.
attrs - An AttributeSet passed to our parent.
defStyle - The default style resource ID.
Method Detail

onSavePassword

boolean onSavePassword(String host,
                       String username,
                       String password,
                       Message resumeMsg)

setScrollBarStyle

public void setScrollBarStyle(int style)
Description copied from class: View

Specify the style of the scrollbars. The scrollbars can be overlaid or inset. When inset, they add to the padding of the view. And the scrollbars can be drawn inside the padding area or on the edge of the view. For example, if a view has a background drawable and you want to draw the scrollbars inside the padding specified by the drawable, you can use SCROLLBARS_INSIDE_OVERLAY or SCROLLBARS_INSIDE_INSET. If you want them to appear at the edge of the view, ignoring the padding, then you can use SCROLLBARS_OUTSIDE_OVERLAY or SCROLLBARS_OUTSIDE_INSET.

Overrides:
setScrollBarStyle in class View
Parameters:
style - the style of the scrollbars. Should be one of SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_INSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY or SCROLLBARS_OUTSIDE_INSET.
See Also:
View.SCROLLBARS_INSIDE_OVERLAY, View.SCROLLBARS_INSIDE_INSET, View.SCROLLBARS_OUTSIDE_OVERLAY, View.SCROLLBARS_OUTSIDE_INSET

setHorizontalScrollbarOverlay

public void setHorizontalScrollbarOverlay(boolean overlay)
Specify whether the horizontal scrollbar has overlay style.

Parameters:
overlay - TRUE if horizontal scrollbar should have overlay style.

setVerticalScrollbarOverlay

public void setVerticalScrollbarOverlay(boolean overlay)
Specify whether the vertical scrollbar has overlay style.

Parameters:
overlay - TRUE if vertical scrollbar should have overlay style.

overlayHorizontalScrollbar

public boolean overlayHorizontalScrollbar()
Return whether horizontal scrollbar has overlay style

Returns:
TRUE if horizontal scrollbar has overlay style.

overlayVerticalScrollbar

public boolean overlayVerticalScrollbar()
Return whether vertical scrollbar has overlay style

Returns:
TRUE if vertical scrollbar has overlay style.

getCertificate

public SslCertificate getCertificate()
Returns:
The SSL certificate for the main top-level page or null if there is no certificate (the site is not secure).

setCertificate

public void setCertificate(SslCertificate certificate)
Sets the SSL certificate for the main top-level page.


savePassword

public void savePassword(String host,
                         String username,
                         String password)
Save the username and password for a particular host in the WebView's internal database.

Parameters:
host - The host that required the credentials.
username - The username for the given host.
password - The password for the given host.

setHttpAuthUsernamePassword

public void setHttpAuthUsernamePassword(String host,
                                        String realm,
                                        String username,
                                        String password)
Set the HTTP authentication credentials for a given host and realm.

Parameters:
host - The host for the credentials.
realm - The realm for the credentials.
username - The username for the password. If it is null, it means password can't be saved.
password - The password

getHttpAuthUsernamePassword

public String[] getHttpAuthUsernamePassword(String host,
                                            String realm)
Retrieve the HTTP authentication username and password for a given host & realm pair

Parameters:
host - The host for which the credentials apply.
realm - The realm for which the credentials apply.
Returns:
String[] if found, String[0] is username, which can be null and String[1] is password. Return null if it can't find anything.

destroy

public void destroy()
Destroy the internal state of the WebView. This method should be called after the WebView has been removed from the view system. No other methods may be called on a WebView after destroy.


enablePlatformNotifications

public static void enablePlatformNotifications()
Enables platform notifications of data state and proxy changes.


disablePlatformNotifications

public static void disablePlatformNotifications()
If platform notifications are enabled, this should be called from onPause() or onStop().


saveState

public WebBackForwardList saveState(Bundle outState)
Save the state of this WebView used in Activity.onSaveInstanceState.

Parameters:
outState - The Bundle to store the WebView state.
Returns:
The same copy of the back/forward list used to save the state. If saveState fails, the returned list will be null.

restoreState

public WebBackForwardList restoreState(Bundle inState)
Restore the state of this WebView from the given map used in Activity.onThaw. This method should be called to restore the state of the WebView before using the object. If it is called after the WebView has had a chance to build state (load pages, create a back/forward list, etc.) there may be undesirable side-effects.

Parameters:
inState - The incoming Bundle of state.
Returns:
The restored back/forward list or null if restoreState failed.

loadUrl

public void loadUrl(String url)
Load the given url.

Parameters:
url - The url of the resource to load.

loadData

public void loadData(String data,
                     String mimeType,
                     String encoding)
Load the given data into the WebView. This will load the data into WebView using the data: scheme. Content loaded through this mechanism does not have the ability to load content from the network.

Parameters:
data - A String of data in the given encoding.
mimeType - The MIMEType of the data. i.e. text/html, image/jpeg
encoding - The encoding of the data. i.e. utf-8, base64

loadDataWithBaseURL

public void loadDataWithBaseURL(String baseUrl,
                                String data,
                                String mimeType,
                                String encoding,
                                String failUrl)
Load the given data into the WebView, use the provided URL as the base URL for the content. The base URL is the URL that represents the page that is loaded through this interface. As such, it is used for the history entry and to resolve any relative URLs. The failUrl is used if browser fails to load the data provided. If it is empty or null, and the load fails, then no history entry is created.

Parameters:
baseUrl - Url to resolve relative paths with, if null defaults to "about:blank"
data - A String of data in the given encoding.
mimeType - The MIMEType of the data. i.e. text/html. If null, defaults to "text/html"
encoding - The encoding of the data. i.e. utf-8, us-ascii
failUrl - URL to use if the content fails to load or null.

stopLoading

public void stopLoading()
Stop the current load.


reload

public void reload()
Reload the current url.


canGoBack

public boolean canGoBack()
Return true if this WebView has a back history item.

Returns:
True iff this WebView has a back history item.

goBack

public void goBack()
Go back in the history of this WebView.


canGoForward

public boolean canGoForward()
Return true if this WebView has a forward history item.

Returns:
True iff this Webview has a forward history item.

goForward

public void goForward()
Go forward in the history of this WebView.


canGoBackOrForward

public boolean canGoBackOrForward(int steps)
Return true if the page can go back or forward the given number of steps.

Parameters:
steps - The negative or positive number of steps to move the history.

goBackOrForward

public void goBackOrForward(int steps)
Go to the history item that is the number of steps away from the current item. Steps is negative if backward and positive if forward.

Parameters:
steps - The number of steps to take back or forward in the back forward list.

pageUp

public boolean pageUp(boolean top)
Scroll the contents of the view up by half the view size

Parameters:
top - true to jump to the top of the page
Returns:
true if the page was scrolled

pageDown

public boolean pageDown(boolean bottom)
Scroll the contents of the view down by half the page size

Parameters:
bottom - true to jump to bottom of page
Returns:
true if the page was scrolled

clearView

public void clearView()
Clear the view so that onDraw() will draw nothing but white background, and onMeasure() will return 0 if MeasureSpec is not MeasureSpec.EXACTLY


capturePicture

public Picture capturePicture()
Return a new picture that captures the current display of the webview. This is a copy of the display, and will be unaffected if the webview later loads a different URL.

Returns:
a picture containing the current contents of the view. Note this picture is of the entire document, and is not restricted to the bounds of the view.

getScale

public float getScale()
Return the current scale of the WebView

Returns:
The current scale.

setInitialScale

public void setInitialScale(int scaleInPercent)
Set the initial scale for the WebView. 0 means default. If WebSettings.getUseWideViewPort() is true, it zooms out all the way. Otherwise it starts with 100%. If initial scale is greater than 0, WebView starts will this value as initial scale.

Parameters:
scaleInPercent - The initial scale in percent.

invokeZoomPicker

public void invokeZoomPicker()
Invoke the graphical zoom picker widget for this WebView. This will result in the zoom widget appearing on the screen to control the zoom level of this WebView.


getHitTestResult

public WebView.HitTestResult getHitTestResult()
Return a HitTestResult based on the current focus node. If a HTML::a tag is found, the HitTestResult type is set to ANCHOR_TYPE and the url has to be retrieved through requestFocusNodeHref(android.os.Message) asynchronously. If a HTML::img tag is found, the HitTestResult type is set to IMAGE_TYPE and the url has to be retrieved through requestFocusNodeHref(android.os.Message) asynchronously. If a phone number is found, the HitTestResult type is set to PHONE_TYPE and the phone number is set in the "extra" field of HitTestResult. If a map address is found, the HitTestResult type is set to GEO_TYPE and the address is set in the "extra" field of HitTestResult. If an email address is found, the HitTestResult type is set to EMAIL_TYPE and the email is set in the "extra" field of HitTestResult. Otherwise, HitTestResult type is set to UNKNOWN_TYPE.


requestFocusNodeHref

public void requestFocusNodeHref(Message hrefMsg)
Request the href of an anchor element due to getFocusNodePath returning "href." If hrefMsg is null, this method returns immediately and does not dispatch hrefMsg to its target.

Parameters:
hrefMsg - This message will be dispatched with the result of the request as the data member with "url" as key. The result can be null.

requestImageRef

public void requestImageRef(Message msg)
Request the url of the image last touched by the user. msg will be sent to its target with a String representing the url as its object.

Parameters:
msg - This message will be dispatched with the result of the request as the data member with "url" as key. The result can be null.

viewToContent

int viewToContent(int x)

computeHorizontalScrollRange

protected int computeHorizontalScrollRange()
Description copied from class: View

Compute the horizontal range that the horizontal scrollbar represents.

The range is expressed in arbitrary units that must be the same as the units used by View.computeHorizontalScrollExtent() and View.computeHorizontalScrollOffset().

The default range is the drawing width of this view.

Overrides:
computeHorizontalScrollRange in class View
Returns:
the total horizontal range represented by the horizontal scrollbar
See Also:
View.computeHorizontalScrollExtent(), View.computeHorizontalScrollOffset(), ScrollBarDrawable

computeVerticalScrollRange

protected int computeVerticalScrollRange()
Description copied from class: View

Compute the vertical range that the vertical scrollbar represents.

The range is expressed in arbitrary units that must be the same as the units used by View.computeVerticalScrollExtent() and View.computeVerticalScrollOffset().

Overrides:
computeVerticalScrollRange in class View
Returns:
the total vertical range represented by the vertical scrollbar

The default range is the drawing height of this view.

See Also:
View.computeVerticalScrollExtent(), View.computeVerticalScrollOffset(), ScrollBarDrawable

getUrl

public String getUrl()
Get the url for the current page. This is not always the same as the url passed to WebViewClient.onPageStarted because although the load for that url has begun, the current page may not have changed.

Returns:
The url for the current page.

getTitle

public String getTitle()
Get the title for the current page. This is the title of the current page until WebViewClient.onReceivedTitle is called.

Returns:
The title for the current page.

getFavicon

public Bitmap getFavicon()
Get the favicon for the current page. This is the favicon of the current page until WebViewClient.onReceivedIcon is called.

Returns:
The favicon for the current page.

getProgress

public int getProgress()
Get the progress for the current page.

Returns:
The progress for the current page between 0 and 100.

getContentHeight

public int getContentHeight()
Returns:
the height of the HTML content.

pauseTimers

public void pauseTimers()
Pause all layout, parsing, and javascript timers. This can be useful if the WebView is not visible or the application has been paused.


resumeTimers

public void resumeTimers()
Resume all layout, parsing, and javascript timers. This will resume dispatching all timers.


clearCache

public void clearCache(boolean includeDiskFiles)
Clear the resource cache. This will cause resources to be re-downloaded if accessed again.

Note: this really needs to be a static method as it clears cache for all WebView. But we need mWebViewCore to send message to WebCore thread, so we can't make this static.


clearFormData

public void clearFormData()
Make sure that clearing the form data removes the adapter from the currently focused textfield if there is one.


clearHistory

public void clearHistory()
Tell the WebView to clear its internal back/forward list.


clearSslPreferences

public void clearSslPreferences()
Clear the SSL preferences table stored in response to proceeding with SSL certificate errors.


copyBackForwardList

public WebBackForwardList copyBackForwardList()
Return the WebBackForwardList for this WebView. This contains the back/forward list for use in querying each item in the history stack. This is a copy of the private WebBackForwardList so it contains only a snapshot of the current state. Multiple calls to this method may return different objects. The object returned from this method will not be updated to reflect any new state.


findAddress

public static String findAddress(String addr)
Return the first substring consisting of the address of a physical location. Currently, only addresses in the United States are detected, and consist of: - a house number - a street name - a street type (Road, Circle, etc), either spelled out or abbreviated - a city name - a state or territory, either spelled out or two-letter abbr. - an optional 5 digit or 9 digit zip code. All names must be correctly capitalized, and the zip code, if present, must be valid for the state. The street type must be a standard USPS spelling or abbreviation. The state or territory must also be spelled or abbreviated using USPS standards. The house number may not exceed five digits.

Parameters:
addr - The string to search for addresses.
Returns:
the address, or if no address is found, return null.

documentHasImages

public void documentHasImages(Message response)
Query the document to see if it contains any image references. The message object will be dispatched with arg1 being set to 1 if images were found and 0 if the document does not reference any images.

Parameters:
response - The message that will be dispatched with the result.

computeScroll

public void computeScroll()
Description copied from class: View
Called by a parent to request that a child update its values for mScrollX and mScrollY if necessary. This will typically be done if the child is animating a scroll using a Scroller object.

Overrides:
computeScroll in class View

setWebViewClient

public void setWebViewClient(WebViewClient client)
Set the WebViewClient that will receive various notifications and requests. This will replace the current handler.

Parameters:
client - An implementation of WebViewClient.

setDownloadListener

public void setDownloadListener(DownloadListener listener)
Register the interface to be used when content can not be handled by the rendering engine, and should be downloaded instead. This will replace the current handler.

Parameters:
listener - An implementation of DownloadListener.

setWebChromeClient

public void setWebChromeClient(WebChromeClient client)
Set the chrome handler. This is an implementation of WebChromeClient for use in handling Javascript dialogs, favicons, titles, and the progress. This will replace the current handler.

Parameters:
client - An implementation of WebChromeClient.

setPictureListener

public void setPictureListener(WebView.PictureListener listener)
Set the Picture listener. This is an interface used to receive notifications of a new Picture.

Parameters:
listener - An implementation of WebView.PictureListener.

externalRepresentation

public void externalRepresentation(Message callback)


documentAsText

public void documentAsText(Message callback)


addJavascriptInterface

public void addJavascriptInterface(Object obj,
                                   String interfaceName)
Use this function to bind an object to Javascript so that the methods can be accessed from Javascript. IMPORTANT, the object that is bound runs in another thread and not in the thread that it was constructed in.

Parameters:
obj - The class instance to bind to Javascript
interfaceName - The name to used to expose the class in Javascript

getSettings

public WebSettings getSettings()
Return the WebSettings object used to control the settings for this WebView.

Returns:
A WebSettings object that can be used to control this WebView's settings.

getPluginList

public static PluginList getPluginList()
Return the list of currently loaded plugins.

Returns:
The list of currently loaded plugins.

refreshPlugins

public void refreshPlugins(boolean reloadOpenPages)
Signal the WebCore thread to refresh its list of plugins. Use this if the directory contents of one of the plugin directories has been modified and needs its changes reflecting. May cause plugin load and/or unload.

Parameters:
reloadOpenPages - Set to true to reload all open pages.

finalize

protected void finalize()
                 throws Throwable
Description copied from class: Object
Called by the virtual machine when there are no longer any (non-weak) references to the receiver. Subclasses can use this facility to guarantee that any associated resources are cleaned up before the receiver is garbage collected. Uncaught exceptions which are thrown during the running of the method cause it to terminate immediately, but are otherwise ignored.

Note: The virtual machine assumes that the implementation in class Object is empty.

Overrides:
finalize in class View
Throws:
Throwable - The virtual machine ignores any exceptions which are thrown during finalization.

onDraw

protected void onDraw(Canvas canvas)
Description copied from class: View
Implement this to do your drawing.

Overrides:
onDraw in class View
Parameters:
canvas - the canvas on which the background will be drawn

setLayoutParams

public void setLayoutParams(ViewGroup.LayoutParams params)
Description copied from class: View
Set the layout parameters associated with this view. These supply parameters to the parent of this view specifying how it should be arranged. There are many subclasses of ViewGroup.LayoutParams, and these correspond to the different subclasses of ViewGroup that are responsible for arranging their children.

Overrides:
setLayoutParams in class View
Parameters:
params - the layout parameters for this view

performLongClick

public boolean performLongClick()
Description copied from class: View
Call this view's OnLongClickListener, if it is defined. Invokes the context menu if the OnLongClickListener did not consume the event.

Overrides:
performLongClick in class View
Returns:
True there was an assigned OnLongClickListener that was called, false otherwise is returned.

drawHistory

boolean drawHistory()

switchOutDrawHistory

void switchOutDrawHistory()

deleteSelection

void deleteSelection(int start,
                     int end)
Delete text from start to end in the focused textfield. If there is no focus, or if start == end, silently fail. If start and end are out of order, swap them.

Parameters:
start - Beginning of selection to delete.
end - End of selection to delete.

setSelection

void setSelection(int start,
                  int end)
Set the selection to (start, end) in the focused textfield. If start and end are out of order, swap them.

Parameters:
start - Beginning of selection.
end - End of selection.

onKeyDown

public boolean onKeyDown(int keyCode,
                         KeyEvent event)
Description copied from class: View
Default implementation of KeyEvent.Callback.onKeyMultiple(): perform press of the view when KeyEvent.KEYCODE_DPAD_CENTER or KeyEvent.KEYCODE_ENTER is released, if the view is enabled and clickable.

Specified by:
onKeyDown in interface KeyEvent.Callback
Overrides:
onKeyDown in class View
Parameters:
keyCode - A key code that represents the button pressed, from KeyEvent.
event - The KeyEvent object that defines the button action.
Returns:
If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

onKeyUp

public boolean onKeyUp(int keyCode,
                       KeyEvent event)
Description copied from class: View
Default implementation of KeyEvent.Callback.onKeyMultiple(): perform clicking of the view when KeyEvent.KEYCODE_DPAD_CENTER or KeyEvent.KEYCODE_ENTER is released.

Specified by:
onKeyUp in interface KeyEvent.Callback
Overrides:
onKeyUp in class View
Parameters:
keyCode - A key code that represents the button pressed, from KeyEvent.
event - The KeyEvent object that defines the button action.
Returns:
If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.

onAttachedToWindow

protected void onAttachedToWindow()
Description copied from class: View
This is called when the view is attached to a window. At this point it has a Surface and will start drawing. Note that this function is guaranteed to be called before View.onDraw(android.graphics.Canvas), however it may be called any time before the first onDraw -- including before or after View.onMeasure(int, int).

Overrides:
onAttachedToWindow in class View
See Also:
View.onDetachedFromWindow()

onDetachedFromWindow

protected void onDetachedFromWindow()
Description copied from class: View
This is called when the view is detached from a window. At this point it no longer has a surface for drawing.

Overrides:
onDetachedFromWindow in class View
See Also:
View.onAttachedToWindow()

onChildViewAdded

public void onChildViewAdded(View parent,
                             View child)
Description copied from interface: ViewGroup.OnHierarchyChangeListener
Called when a new child is added to a parent view.

Specified by:
onChildViewAdded in interface ViewGroup.OnHierarchyChangeListener
Parameters:
parent - the view in which a child was added
child - the new child view added in the hierarchy

onChildViewRemoved

public void onChildViewRemoved(View p,
                               View child)
Description copied from interface: ViewGroup.OnHierarchyChangeListener
Called when a child is removed from a parent view.

Specified by:
onChildViewRemoved in interface ViewGroup.OnHierarchyChangeListener
Parameters:
p - the view from which the child was removed
child - the child removed from the hierarchy

onGlobalFocusChanged

public void onGlobalFocusChanged(View oldFocus,
                                 View newFocus)
Description copied from interface: ViewTreeObserver.OnGlobalFocusChangeListener
Callback method to be invoked when the focus changes in the view tree. When the view tree transitions from touch mode to non-touch mode, oldFocus is null. When the view tree transitions from non-touch mode to touch mode, newFocus is null. When focus changes in non-touch mode (without transition from or to touch mode) either oldFocus or newFocus can be null.

Specified by:
onGlobalFocusChanged in interface ViewTreeObserver.OnGlobalFocusChangeListener
Parameters:
oldFocus - The previously focused view, if any.
newFocus - The newly focused View, if any.

onWindowFocusChanged

public void onWindowFocusChanged(boolean hasWindowFocus)
Description copied from class: View
Called when the window containing this view gains or loses focus. Note that this is separate from view focus: to receive key events, both your view and its window must have focus. If a window is displayed on top of yours that takes input focus, then your own window will lose focus but the view focus will remain unchanged.

Overrides:
onWindowFocusChanged in class View
Parameters:
hasWindowFocus - True if the window containing this view now has focus, false otherwise.

onFocusChanged

protected void onFocusChanged(boolean focused,
                              int direction,
                              Rect previouslyFocusedRect)
Description copied from class: View
Called by the view system when the focus state of this view changes. When the focus change event is caused by directional navigation, direction and previouslyFocusedRect provide insight into where the focus is coming from.

Overrides:
onFocusChanged in class View
Parameters:
focused - True if the View has focus; false otherwise.
direction - The direction focus has moved when requestFocus() is called to give this view focus. Values are View.FOCUS_UP, View.FOCUS_DOWN, View.FOCUS_LEFT or View.FOCUS_RIGHT. It may not always apply, in which case use the default.
previouslyFocusedRect - The rectangle, in this view's coordinate system, of the previously focused view. If applicable, this will be passed in as finer grained information about where the focus is coming from (in addition to direction). Will be null otherwise.

onSizeChanged

protected void onSizeChanged(int w,
                             int h,
                             int ow,
                             int oh)
Description copied from class: View
This is called during layout when the size of this view has changed. If you were just added to the view hierarchy, you're called with the old values of 0.

Overrides:
onSizeChanged in class View
Parameters:
w - Current width of this view.
h - Current height of this view.
ow - Old width of this view.
oh - Old height of this view.

onScrollChanged

protected void onScrollChanged(int l,
                               int t,
                               int oldl,
                               int oldt)
Description copied from class: View
This is called in response to an internal scroll in this view (i.e., the view scrolled its own contents). This is typically as a result of View.scrollBy(int, int) or View.scrollTo(int, int) having been called.

Overrides:
onScrollChanged in class View
Parameters:
l - Current horizontal scroll origin.
t - Current vertical scroll origin.
oldl - Previous horizontal scroll origin.
oldt - Previous vertical scroll origin.

dispatchKeyEvent

public boolean dispatchKeyEvent(KeyEvent event)
Description copied from class: ViewGroup
Dispatch a key event to the next view on the focus path. This path runs from the top of the view tree down to the currently focused view. If this view has focus, it will dispatch to itself. Otherwise it will dispatch the next node down the focus path. This method also fires any key listeners.

Overrides:
dispatchKeyEvent in class ViewGroup
Parameters:
event - The key event to be dispatched.
Returns:
True if the event was handled, false otherwise.

onTouchEvent

public boolean onTouchEvent(MotionEvent ev)
Description copied from class: View
Implement this method to handle touch screen motion events.

Overrides:
onTouchEvent in class View
Parameters:
ev - The motion event.
Returns:
True if the event was handled, false otherwise.

setMapTrackballToArrowKeys

public void setMapTrackballToArrowKeys(boolean setMap)

resetTrackballTime

void resetTrackballTime()

onTrackballEvent

public boolean onTrackballEvent(MotionEvent ev)
Description copied from class: View
Implement this method to handle trackball motion events. The relative movement of the trackball since the last event can be retrieve with MotionEvent.getX() and MotionEvent.getY(). These are normalized so that a movement of 1 corresponds to the user pressing one DPAD key (so they will often be fractional values, representing the more fine-grained movement information available from a trackball).

Overrides:
onTrackballEvent in class View
Parameters:
ev - The motion event.
Returns:
True if the event was handled, false otherwise.

moveSelection

void moveSelection(float xRate,
                   float yRate)

flingScroll

public void flingScroll(int vx,
                        int vy)

getZoomControls

public View getZoomControls()
Returns a view containing zoom controls i.e. +/- buttons. The caller is in charge of installing this view to the view hierarchy. This view will become visible when the user starts scrolling via touch and fade away if the user does not interact with it.


zoomIn

public boolean zoomIn()
Perform zoom in in the webview

Returns:
TRUE if zoom in succeeds. FALSE if no zoom changes.

zoomOut

public boolean zoomOut()
Perform zoom out in the webview

Returns:
TRUE if zoom out succeeds. FALSE if no zoom changes.

shortPressOnTextField

void shortPressOnTextField()

requestFocus

public boolean requestFocus(int direction,
                            Rect previouslyFocusedRect)
Description copied from class: ViewGroup
Call this to try to give focus to a specific view or to one of its descendants and give it hints about the direction and a specific rectangle that the focus is coming from. The rectangle can help give larger views a finer grained hint about where focus is coming from, and therefore, where to show selection, or forward focus change internally. A view will not actually take focus if it is not focusable (View.isFocusable() returns false), or if it is focusable and it is not focusable in touch mode (View.isFocusableInTouchMode()) while the device is in touch mode. A View will not take focus if it is not visible. A View will not take focus if one of its parents has ViewGroup.getDescendantFocusability() equal to ViewGroup.FOCUS_BLOCK_DESCENDANTS. See also View.focusSearch(int), which is what you call to say that you have focus, and you want your parent to look for the next one. You may wish to override this method if your custom View has an internal View that it wishes to forward the request to. Looks for a view to give focus to respecting the setting specified by ViewGroup.getDescendantFocusability(). Uses ViewGroup.onRequestFocusInDescendants(int, android.graphics.Rect) to find focus within the children of this group when appropriate.

Overrides:
requestFocus in class ViewGroup
Parameters:
direction - One of FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, and FOCUS_RIGHT
previouslyFocusedRect - The rectangle (in this View's coordinate system) to give a finer grained hint about where focus is coming from. May be null if there is no hint.
Returns:
Whether this view or one of its descendants actually took focus.
See Also:
ViewGroup.FOCUS_BEFORE_DESCENDANTS, ViewGroup.FOCUS_AFTER_DESCENDANTS, ViewGroup.FOCUS_BLOCK_DESCENDANTS, ViewGroup.onRequestFocusInDescendants(int, android.graphics.Rect)

onMeasure

protected void onMeasure(int widthMeasureSpec,
                         int heightMeasureSpec)
Description copied from class: View

Measure the view and its content to determine the measured width and the measured height. This method is invoked by View.measure(int, int) and should be overriden by subclasses to provide accurate and efficient measurement of their contents.

CONTRACT: When overriding this method, you must call View.setMeasuredDimension(int, int) to store the measured width and height of this view. Failure to do so will trigger an IllegalStateException, thrown by View.measure(int, int). Calling the superclass' View.onMeasure(int, int) is a valid use.

The base class implementation of measure defaults to the background size, unless a larger size is allowed by the MeasureSpec. Subclasses should override View.onMeasure(int, int) to provide better measurements of their content.

If this method is overridden, it is the subclass's responsibility to make sure the measured height and width are at least the view's minimum height and width (View.getSuggestedMinimumHeight() and View.getSuggestedMinimumWidth()).

Overrides:
onMeasure in class AbsoluteLayout
Parameters:
widthMeasureSpec - horizontal space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec.
heightMeasureSpec - vertical space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec.
See Also:
View.getMeasuredWidth(), View.getMeasuredHeight(), View.setMeasuredDimension(int, int), View.getSuggestedMinimumHeight(), View.getSuggestedMinimumWidth(), View.MeasureSpec.getMode(int), View.MeasureSpec.getSize(int)

requestChildRectangleOnScreen

public boolean requestChildRectangleOnScreen(View child,
                                             Rect rect,
                                             boolean immediate)
Description copied from class: ViewGroup
Called when a child of this group wants a particular rectangle to be positioned onto the screen. ViewGroups overriding this can trust that:

ViewGroups overriding this should uphold the contract:


replaceTextfieldText

void replaceTextfieldText(int oldStart,
                          int oldEnd,
                          String replace,
                          int newStart,
                          int newEnd)

passToJavaScript

void passToJavaScript(String currentText,
                      KeyEvent event)

getWebViewCore

WebViewCore getWebViewCore()

requestListBox

void requestListBox(String[] array,
                    boolean[] enabledArray,
                    int[] selectedArray)

requestListBox

void requestListBox(String[] array,
                    boolean[] enabledArray,
                    int selection)

setBackgroundColor

public void setBackgroundColor(int color)
Set the background color. It's white by default. Pass zero to make the view transparent.

Overrides:
setBackgroundColor in class View
Parameters:
color - the ARGB color described by Color.java

debugDump

public void debugDump()

updateCachedTextfield

void updateCachedTextfield(String updatedText)
Update our cache with updatedText.

Parameters:
updatedText - The new text to put in our cache.

Build 1.0_r1(from source)

Please submit a feedback, bug or feature