Java android.webkit WebView fields, constructors, methods, implement or subclass

Example usage for Java android.webkit WebView fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for android.webkit WebView.

The text is from its open source code.

Subclass

android.webkit.WebView has subclasses.
Click this link to see all its subclasses.

Field

StringSCHEME_TEL
URI scheme for telephone number.
StringSCHEME_MAILTO
URI scheme for email address.

Constructor

WebView(Context context)
Constructs a new WebView with an Activity Context object.

Method

voidaddJavascriptInterface(Object object, String name)
Injects the supplied Java object into this WebView.
voidbuildDrawingCache()

Calling this method is equivalent to calling buildDrawingCache(false).

booleancanGoBack()
Gets whether this WebView has a back history item.
booleancanGoForward()
Gets whether this WebView has a forward history item.
PicturecapturePicture()
Gets a new picture that captures the current contents of this WebView.
voidclearCache(boolean includeDiskFiles)
Clears the resource cache.
voidclearFormData()
Removes the autocomplete popup from the currently focused form field, if present.
voidclearHistory()
Tells this WebView to clear its internal back/forward list.
voidclearMatches()
Clears the highlighting surrounding text matches created by #findAllAsync .
voidclearView()
Clears this WebView so that onDraw() will draw nothing but white background, and onMeasure() will return 0 if MeasureSpec is not MeasureSpec.EXACTLY.
WebBackForwardListcopyBackForwardList()
Gets the WebBackForwardList for this WebView.
PrintDocumentAdaptercreatePrintDocumentAdapter()
PrintDocumentAdaptercreatePrintDocumentAdapter(String documentName)
Creates a PrintDocumentAdapter that provides the content of this WebView for printing.
voiddestroy()
Destroys the internal state of this WebView.
voiddestroyDrawingCache()

Frees the resources used by the drawing cache.

voiddisablePlatformNotifications()
Disables platform notifications of data state and proxy changes.
voiddraw(Canvas canvas)
Manually render this view (and all of its children) to the given Canvas.
voidenablePlatformNotifications()
Enables platform notifications of data state and proxy changes.
voidenableSlowWholeDocumentDraw()
For apps targeting the L release, WebView has a new default behavior that reduces memory footprint and increases performance by intelligently choosing the portion of the HTML document that needs to be drawn.
voidevaluateJavascript(String script, @Nullable ValueCallback resultCallback)
Asynchronously evaluates JavaScript in the context of the currently displayed page.
StringfindAddress(String addr)
Gets the first substring consisting of the address of a physical location.
voidfindAllAsync(String find)
Finds all instances of find on the page and highlights them, asynchronously.
TfindViewById(@IdRes int id)
Finds the first descendant view with the given ID, the view itself if the ID matches #getId() , or null if the ID is invalid (< 0) or there is no matching view in the hierarchy.
DrawablegetBackground()
Gets the background drawable
SslCertificategetCertificate()
Gets the SSL certificate for the main top-level page or null if there is no certificate (the site is not secure).
ClassgetClass()
Returns the runtime class of this Object .
intgetContentHeight()
Gets the height of the HTML content.
ContextgetContext()
Returns the context the view is running in, through which it can access the current theme, resources, etc.
BitmapgetDrawingCache()

Calling this method is equivalent to calling getDrawingCache(false).

HandlergetHandler()
intgetHeight()
Return the height of your view.
HitTestResultgetHitTestResult()
Gets a HitTestResult based on the current cursor node.
String[]getHttpAuthUsernamePassword(String host, String realm)
Retrieves HTTP authentication credentials for a given host and realm from the WebViewDatabase instance.
intgetId()
Returns this view's identifier.
intgetLayerType()
Indicates what type of layer is currently associated with this view.
ViewGroup.LayoutParamsgetLayoutParams()
Get the LayoutParams associated with this view.
intgetMeasuredHeight()
Like #getMeasuredHeightAndState() , but only returns the raw height component (that is the result is masked by #MEASURED_SIZE_MASK ).
intgetMeasuredWidth()
Like #getMeasuredWidthAndState() , but only returns the raw width component (that is the result is masked by #MEASURED_SIZE_MASK ).
StringgetOriginalUrl()
Gets the original URL for the current page.
ViewParentgetParent()
Gets the parent of this view.
PluginListgetPluginList()
Gets the list of currently loaded plugins.
ResourcesgetResources()
Returns the resources associated with this view.
floatgetScale()
Gets the current scale of this WebView.
intgetScrollY()
Return the scrolled top position of this view.
WebSettingsgetSettings()
Gets the WebSettings object used to control the settings for this WebView.
ObjectgetTag()
Returns this view's tag.
StringgetTitle()
Gets the title for the current page.
StringgetUrl()
Gets the URL for the current page.
intgetWidth()
Return the width of your view.
voidgoBack()
Goes back in the history of this WebView.
voidgoForward()
Goes forward in the history of this WebView.
inthashCode()
Returns a hash code value for the object.
voidinvalidate()
Invalidate the whole view.
booleanisFocusable()
Returns whether this View is currently able to take focus.
booleanisFocusableInTouchMode()
When a view is focusable, it may not want to take focus when in touch mode.
booleanisShown()
Returns the visibility of this view and all of its ancestors
voidlayout(int l, int t, int r, int b)
voidloadData(String data, @Nullable String mimeType, @Nullable String encoding)
Loads the given data into this WebView using a 'data' scheme URL.
voidloadDataWithBaseURL(@Nullable String baseUrl, String data, @Nullable String mimeType, @Nullable String encoding, @Nullable String historyUrl)
Loads the given data into this WebView, using baseUrl as the base URL for the content.
voidloadUrl(String url)
Loads the given URL.
voidloadUrl(String url, Map additionalHttpHeaders)
Loads the given URL with the specified additional HTTP headers.
voidmeasure(int widthMeasureSpec, int heightMeasureSpec)

This is called to find out how big a view should be.

booleanonTouchEvent(MotionEvent event)
booleanpost(Runnable action)

Causes the Runnable to be added to the message queue.

voidpostUrl(String url, byte[] postData)
Loads the URL with postData using "POST" method into this WebView.
voidreload()
Reloads the current URL.
voidremoveAllViews()
Call this method to remove all child views from the ViewGroup.
voidremoveJavascriptInterface(@NonNull String name)
Removes a previously injected Java object from this WebView.
booleanrequestFocus(int direction)
Call this to try to give focus to a specific view or to one of its descendants and give it a hint about what direction focus is heading.
voidrequestFocusNodeHref(@Nullable Message hrefMsg)
Requests the anchor or image element URL at the last tapped point.
voidrequestLayout()
Call this when something has changed which has invalidated the layout of this view.
WebBackForwardListrestoreState(Bundle inState)
Restores the state of this WebView from the given Bundle.
WebBackForwardListsaveState(Bundle outState)
Saves the state of this WebView used in android.app.Activity#onSaveInstanceState .
voidsaveWebArchive(String filename)
Saves the current view as a web archive.
voidscrollTo(int x, int y)
Set the scrolled position of your view.
voidsetBackgroundColor(int color)
voidsetClickable(boolean clickable)
Enables or disables click events for this view.
voidsetDownloadListener(DownloadListener listener)
Registers the interface to be used when content can not be handled by the rendering engine, and should be downloaded instead.
voidsetDrawingCacheEnabled(boolean enabled)

Enables or disables the drawing cache.

voidsetEnabled(boolean enabled)
Set the enabled state of this view.
voidsetFindListener(FindListener listener)
Registers the listener to be notified as find-on-page operations progress.
voidsetFocusable(boolean focusable)
Set whether this view can receive the focus.
voidsetFocusableInTouchMode(boolean focusableInTouchMode)
Set whether this view can receive focus while in touch mode.
voidsetHorizontalScrollBarEnabled(boolean horizontalScrollBarEnabled)

Define whether the horizontal scrollbar should be drawn or not.

voidsetHttpAuthUsernamePassword(String host, String realm, String username, String password)
Stores HTTP authentication credentials for a given host and realm to the WebViewDatabase instance.
voidsetInitialScale(int scaleInPercent)
Sets the initial scale for this WebView.
voidsetLayerType(int layerType, Paint paint)
voidsetLayoutParams(ViewGroup.LayoutParams params)
voidsetLongClickable(boolean longClickable)
Enables or disables long click events for this view.
voidsetMinimumWidth(int minWidth)
Sets the minimum width of the view.
voidsetNetworkAvailable(boolean networkUp)
Informs WebView of the network state.
voidsetOnKeyListener(OnKeyListener l)
Register a callback to be invoked when a hardware key is pressed in this view.
voidsetOnLongClickListener(@Nullable OnLongClickListener l)
Register a callback to be invoked when this view is clicked and held.
voidsetOnTouchListener(OnTouchListener l)
Register a callback to be invoked when a touch event is sent to this view.
voidsetOverScrollMode(int mode)
voidsetPadding(int left, int top, int right, int bottom)
Sets the padding.
voidsetPictureListener(PictureListener listener)
Sets the Picture listener.
voidsetScrollbarFadingEnabled(boolean fadeScrollbars)
Define whether scrollbars will fade when the view is not scrolling.
voidsetScrollBarStyle(int style)
voidsetScrollContainer(boolean isScrollContainer)
Change whether this view is one of the set of scrollable containers in its window.
voidsetSystemUiVisibility(int visibility)
Request that the visibility of the status bar or other screen/window decorations be changed.
voidsetTag(final Object tag)
Sets the tag associated with this view.
voidsetTag(int key, final Object tag)
Sets a tag associated with this view and a key.
voidsetVerticalScrollBarEnabled(boolean verticalScrollBarEnabled)

Define whether the vertical scrollbar should be drawn or not.

voidsetVisibility(@Visibility int visibility)
Set the visibility state of this view.
voidsetWebChromeClient(WebChromeClient client)
Sets the chrome handler.
voidsetWebContentsDebuggingEnabled(boolean enabled)
Enables debugging of web contents (HTML / CSS / JavaScript) loaded into any WebViews of this application.
voidsetWebViewClient(WebViewClient client)
Sets the WebViewClient that will receive various notifications and requests.
voidsetWillNotCacheDrawing(boolean willNotCacheDrawing)
When a View's drawing cache is enabled, drawing is redirected to an offscreen bitmap.
voidstopLoading()
Stops the current load.