show Net Image using WebView - Android User Interface

Android examples for User Interface:WebView Image

Description

show Net Image using WebView

Demo Code


//package com.java2s;

import android.content.Context;

import android.webkit.WebView;

public class Main {

    public static void showNetImage(Context mContext,
            final WebView webview, final String imageLocalUrl, int width,
            int height) {
        final String fileName = "image.png";

        String data = "<HTML><IMG src=\"" + imageLocalUrl + "\"" + "width="
                + width + "height=" + height + "/>";
        webview.loadDataWithBaseURL(imageLocalUrl, data, "text/html",
                "utf-8", null);

        //webview.loadUrl(imageUrl);//????????
        webview.getSettings().setBuiltInZoomControls(true); //??????? controler
        webview.getSettings().setSupportZoom(true); //??????
        webview.setSaveEnabled(true);//  w w  w.j av  a2s  . co  m

    }
}

Related Tutorials