Skip to content

Most visited

Recently visited

navigation

WebViewFragment

public class WebViewFragment
extends Fragment

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


A fragment that displays a WebView.

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

Summary

Inherited XML attributes

From class android.app.Fragment

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.

Inherited methods

From class android.app.Fragment
From class java.lang.Object
From interface android.content.ComponentCallbacks2
From interface android.view.View.OnCreateContextMenuListener
From interface android.content.ComponentCallbacks

Public constructors

WebViewFragment

Added in API level 11
WebViewFragment ()

Public methods

getWebView

Added in API level 11
WebView getWebView ()

Gets the WebView.

Returns
WebView

onCreateView

Added in API level 11
View onCreateView (LayoutInflater inflater, 
                ViewGroup container, 
                Bundle savedInstanceState)

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

Parameters
inflater LayoutInflater: The LayoutInflater object that can be used to inflate any views in the fragment,
container ViewGroup: 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 Bundle: If non-null, this fragment is being re-constructed from a previous saved state as given here.
Returns
View Return the View for the fragment's UI, or null.

onDestroy

Added in API level 11
void onDestroy ()

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

onDestroyView

Added in API level 11
void onDestroyView ()

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

onPause

Added in API level 11
void onPause ()

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

onResume

Added in API level 11
void onResume ()

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

This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.