Code example for WebResourceResponse

0
 
    private static class InterceptClient extends WebViewClient {
        @Override 
        public WebResourceResponse shouldInterceptRequest(WebView view, java.lang.String url) {
            try { 
                return new WebResourceResponse("text/html", "utf-8",
                        new ByteArrayInputStream(RAW_HTML.getBytes("UTF-8")));
            } catch(java.io.UnsupportedEncodingException e) {
                return null; 
            } 
        } 
    } 
 
    public class AndroidInterface { 
        @JavascriptInterface 
        public void androidLog(final String msg) {
            Handler handler = new Handler(new Handler.Callback() {
                @Override 
                public boolean handleMessage(Message message) {
                    runOnUiThread(new Runnable() {
                        @Override