Code example for WebView: Displaying web pages

Methods: getSettingsloadUrl, getZoomControls

0
 
        setContentView(config.layout);
 
        url = (intent != null) ? intent.getDataString() : null;
        wv = (WebView) findViewById(R.id.web_view);
        wv.loadUrl(url);
 
        if(config.hasBuiltIn())
        { 
            wv.getSettings().setBuiltInZoomControls(true);
        } 
        buttons = (LinearLayout) findViewById(R.id.web_buttons_layout);
 
        if( config.hasBar() || config.hasZoom())
        { 
            buttons.setVisibility(View.VISIBLE);
 
            back = (ImageButton)findViewById(R.id.web_back);
            if(config.hasBack())
            { 
                back.setOnClickListener(backOnClickListener);
                back.setVisibility(View.VISIBLE);
            } 
            else 
            { 
                back.setVisibility(View.GONE);
            } 
 
            forward = (ImageButton)findViewById(R.id.web_forward);
            if(config.hasForward())
            { 
                forward.setOnClickListener(forwardOnClickListener);
                forward.setVisibility(View.VISIBLE);
            } 
            else 
            { 
                forward.setVisibility(View.GONE);
            } 
 
            home = (ImageButton)findViewById(R.id.web_home);
            if(config.hasHome())
            { 
                home.setOnClickListener(homeOnClickListener);
                home.setVisibility(View.VISIBLE);
            } 
            else 
            { 
                home.setVisibility(View.GONE);
            } 
 
            searchEdit = (EditText)findViewById(R.id.web_search_edit);
            searchGo = (ImageButton)findViewById(R.id.web_search_go);
            if(config.hasSearch())
            { 
                searchEdit.setOnKeyListener(searchEditOnKeyListener);
                searchEdit.setVisibility(View.VISIBLE);
                searchGo.setOnClickListener(searchGoOnClickListener);
                searchGo.setVisibility(View.VISIBLE);
            } 
            else 
            { 
                searchEdit.setVisibility(View.GONE);
                searchGo.setVisibility(View.GONE);
            } 
            if(config.hasZoomCtrl())
            { 
                zoom = wv.getZoomControls();
                buttons.addView(zoom);
                zoom.setVisibility(View.VISIBLE);
            } 
        } 
        else 
        { 
            buttons.setVisibility(View.GONE);
        } 
        if(this.config.hasWideView())
        { 
            wv.getSettings().setUseWideViewPort(true);
        } 
    } 
 
    static void startUrl(Activity parent, String url, Class<?> cls, String config)
    {