Code example for WebView: Displaying local web pages

Methods: loadData

0
 
    protected void applyBinding() { 
        if (container != null) {
            if (isHtml()) { 
                if (htmlWidget == null) {
                    htmlWidget = new WebView(getRootContext());
                    container.removeAllViews();
                    container.addView(htmlWidget);
                } 
                txtWidget = null;
            } else { 
                if (txtWidget == null) {
                    txtWidget = new TextView(getRootContext());
                    container.removeAllViews();
                    container.addView(txtWidget);
                } 
                htmlWidget = null;
            } 
        } 
        if (txtWidget != null) {
            txtWidget.setText(getCurrentValue().get(0));
        } 
        if (htmlWidget != null) {
            htmlWidget.loadData(getCurrentValue().get(0), "text/html", "UTF-8");
        } 
        if (editWidget != null) {
            editWidget.setText(getCurrentValue().get(0));
        } 
    }