姜饼上没有网页

Hoc*_*osc 1 android webview android-webview android-2.3-gingerbread

如果我在Gingerbread Emulator上运行我的代码,它会给我:

网页不可用,以及下面列出的页面的源代码.

如果我在ICS或JB(包括phisical手机和模拟器)上运行应用程序,它确实有效:

    webview = new WebView(InterfacciaPrincipale.this);

    webview.getSettings().setBuiltInZoomControls(true);
    webview.loadData(Html.getHtml(), "text/html", "UTF-8");
    webview.getSettings().setJavaScriptEnabled(true);
    webview.setWebViewClient(new WebViewClient() {

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            new M("Caricamento", getApplicationContext());
            Log.v("ESSE3", "shouldOverrideUrlLoading()");
            System.out.println(url);
            try {
                Html.setHtml(Connessione.generaStringaHTML(Connessione.getUrl(url)));
            } catch (IOException e) {
                e.printStackTrace();
            }
            System.out.println(Html.getHtml());
            webview.loadDataWithBaseURL(null,Html.getHtml(), "text/html", "UTF-8",null);
            return true;

        }
    });
Run Code Online (Sandbox Code Playgroud)

是的,那里有INTERNET权限(适用于ICS和JB ......).

Hoc*_*osc 6

代替:

webview.loadData(Html.getHtml(), "text/html", "UTF-8");
Run Code Online (Sandbox Code Playgroud)

使用

webview.loadDataWithBaseURL(null,Html.getHtml(), "text/html", "UTF-8",null);
Run Code Online (Sandbox Code Playgroud)

在姜饼上.这解决了我的问题.