Code example for Fragment

Methods: getActivity

0
    /** 
     * Sets up the UI. It consists if a single WebView. 
     */ 
    @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        mWebView = new WebView(getActivity());
        loadWebView(); 
        return mWebView;
    } 
 
    /** 
     * Displays a particular article. 
     * 
     * @param article the article to display 
     */ 
    public void displayArticle(NewsArticle article) {
        mNewsArticle = article;
        loadWebView(); 
    } 
 
Experience pair programming with AI  Get Codota for Java