FileDocCategorySizeDatePackage
WebViewFragment.javaAPI DocAndroid 5.1 API2641Thu Mar 12 22:22:10 GMT 2015android.webkit

WebViewFragment

public class WebViewFragment extends android.app.Fragment
A fragment that displays a WebView.

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

Fields Summary
private android.webkit.WebView
mWebView
private boolean
mIsWebViewAvailable
Constructors Summary
public WebViewFragment()

    
Methods Summary
public android.webkit.WebViewgetWebView()
Gets the WebView.

        return mIsWebViewAvailable ? mWebView : null;
    
public android.view.ViewonCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)
Called to instantiate the view. Creates and returns the WebView.

        if (mWebView != null) {
            mWebView.destroy();
        }
        mWebView = new WebView(getActivity());
        mIsWebViewAvailable = true;
        return mWebView;
    
public voidonDestroy()
Called when the fragment is no longer in use. Destroys the internal state of the WebView.

        if (mWebView != null) {
            mWebView.destroy();
            mWebView = null;
        }
        super.onDestroy();
    
public voidonDestroyView()
Called when the WebView has been detached from the fragment. The WebView is no longer available after this time.

        mIsWebViewAvailable = false;
        super.onDestroyView();
    
public voidonPause()
Called when the fragment is visible to the user and actively running. Resumes the WebView.

        super.onPause();
        mWebView.onPause();
    
public voidonResume()
Called when the fragment is no longer resumed. Pauses the WebView.

        mWebView.onResume();
        super.onResume();