Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
public class

WebViewFragment

extends Fragment
java.lang.Object
   ↳ android.app.Fragment
     ↳ android.webkit.WebViewFragment

Class Overview

A fragment that displays a WebView.

The WebView is automically paused or resumed when the Fragment is paused or resumed.

Summary

[Expand]
Inherited Constants
From interface android.content.ComponentCallbacks2
Public Constructors
WebViewFragment ()
Public Methods
WebView getWebView ()
Gets the WebView.
View onCreateView ( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
Called to instantiate the view.
void onDestroy ()
Called when the fragment is no longer in use.
void onDestroyView ()
Called when the WebView has been detached from the fragment.
void onPause ()
Called when the fragment is visible to the user and actively running.
void onResume ()
Called when the fragment is no longer resumed.
[Expand]
Inherited Methods
From class android.app.Fragment
From class java.lang.Object
From interface android.content.ComponentCallbacks
From interface android.content.ComponentCallbacks2
From interface android.view.View.OnCreateContextMenuListener

Public Constructors

public WebViewFragment ()

Public Methods

public WebView getWebView ()

Gets the WebView.

public View onCreateView ( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)

Called to instantiate the view. Creates and returns the WebView.

Parameters
inflater The LayoutInflater object that can be used to inflate any views in the fragment,
container If non-null, this is the parent view that the fragment's UI should be attached to. The fragment should not add the view itself, but this can be used to generate the LayoutParams of the view.
savedInstanceState If non-null, this fragment is being re-constructed from a previous saved state as given here.
Returns
  • Return the View for the fragment's UI, or null.

public void onDestroy ()

Called when the fragment is no longer in use. Destroys the internal state of the WebView.

public void onDestroyView ()

Called when the WebView has been detached from the fragment. The WebView is no longer available after this time.

public void onPause ()

Called when the fragment is visible to the user and actively running. Resumes the WebView.

public void onResume ()

Called when the fragment is no longer resumed. Pauses the WebView.