Android examples for android.graphics:Image Load Save
Load the given image data in byte array into the WebView to show the image
import android.app.Activity; import android.util.Log; import android.view.Display; import android.webkit.WebSettings; import android.webkit.WebView; public class Main{ private static final String TAG = WebViewUtils.class.getSimpleName(); /**/* w ww . j a va2 s . c o m*/ * Load the given image data into the WebView to show the image. * @param webview * @param imageData */ public static void loadImage(WebView webview, byte[] imageData) { final String image64 = android.util.Base64.encodeToString( imageData, android.util.Base64.DEFAULT); String html = "<html><body style='margin:0;padding:0;'><img src=\"data:image/jpeg;base64," + image64 + "\" /></body></html>"; webview.loadDataWithBaseURL("", html, "text/html", "utf-8", ""); } }