Set encode For WebView - Android User Interface

Android examples for User Interface:WebView

Description

Set encode For WebView

Demo Code


//package com.java2s;
import android.util.Log;

import java.io.UnsupportedEncodingException;

public class Main {
    public static String encodeForWebView(String response) {
        try {/*from w w  w.j a v a2s  .  c  o  m*/
            return android.util.Base64
                    .encodeToString(response.getBytes("UTF-8"),
                            android.util.Base64.DEFAULT);
        } catch (UnsupportedEncodingException e) {
            Log.d("EncodeForWeb", response);
        }
        return null;
    }
}

Related Tutorials