Code example for DialogFragment

Methods: onCreate, isVisible

0
            web.setWebViewClient(client);
    } 
 
    public WebViewFragment setUri(Uri uri) {
        this.uri = uri;
        if (web != null && isVisible())
            web.loadUrl(uri.toString());
        return this;
    } 
 
    @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.webview, null);
    } 
 
    @Override 
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        ViewUtils.setOnClicks(view, this, android.R.id.button1);
        mTitle = (TextView)view.findViewById(android.R.id.title);
        if (getShowsDialog())
            ViewUtils.setViewsVisible(view, false, android.R.id.button1, android.R.id.title);
        if (view != null && view instanceof WebView)
            web = (WebView)view;
        else if (view.findViewById(R.id.webview) != null)
            web = (WebView)view.findViewById(R.id.webview);
        OpenChromeClient client = new OpenChromeClient();
        web.setWebViewClient(mClient);
        web.setWebChromeClient(client);
        WebSettings settings = web.getSettings();
        settings.setJavaScriptEnabled(true);
        if (savedInstanceState != null && savedInstanceState.containsKey("url"))
            uri = Uri.parse(savedInstanceState.getString("url"));
        else if (getArguments() != null && getArguments().containsKey("url"))
            uri = Uri.parse(savedInstanceState.getString("url"));
        if (uri != null)
            web.loadUrl(uri.toString());
    } 
 
    @Override 
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (savedInstanceState != null && savedInstanceState.containsKey("url"))
            setUri(Uri.parse(savedInstanceState.getString("url")));
        else if (web != null)
            web.restoreState(savedInstanceState);
    } 
Contextual code suggestions in your IDE  Get Codota for Java