Android网页视图未加载网址

its*_*uys 1 android webview

我在使用以下网址加载webview时遇到问题:

  1. http://www.walmart.com/

  2. http://mobile.walmart.com/

但两者都在webview中显示一个空白页面.

这里我附上了源代码.我该如何摆脱这个问题?

资源:

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.Window;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;

public class WEBVIEW_ITSELF extends Activity {

    WebView homeWeb;
    Button btnPlay;

    final Activity activity = this;
    static Context mContext;

    public boolean orandationChange = true;

    @Override
    protected void onPause() {
        super.onPause();

        orandationChange = false;
    }

    String urlchange;

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        this.getWindow().requestFeature(Window.FEATURE_PROGRESS);
        setContentView(R.layout.i_webview);

        mContext = this;

        homeWeb = (WebView) findViewById(R.id.website_webview);
        homeWeb.getSettings().setJavaScriptEnabled(true);
        homeWeb.getSettings().setSupportZoom(true); // Zoom control on web (You)

        homeWeb.clearHistory();
        homeWeb.clearFormData();
        homeWeb.clearCache(true);

        WebSettings webSettings = homeWeb.getSettings();
        webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);

        homeWeb.setWebChromeClient(new WebChromeClient() {
            public void onProgressChanged(WebView view, int progress) {
                activity.setTitle("Loading...");
                activity.setProgress(progress * 100);

                if (progress == 100)
                    activity.setTitle(R.string.app_name); // To enable this you
                                                          // should not set
                                                          // android:theme="@android:style/Theme.Black.NoTitleBar"
                                                          // in the manifest file.
            }
        });

        homeWeb.setWebViewClient(new WebViewClient() {
            public void onReceivedError(WebView view, int errorCode,
                    String description, String failingUrl) {

                System.out.println(" failingUrl " + failingUrl);
                System.out.println(" description " + description);
                System.out.println(" errorCode " + errorCode);

                // Handle the error
            }

            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {

                view.loadUrl(url);

                return false;
            }
        });

        homeWeb.loadUrl("http://mobile.walmart.com/");
    }
}
Run Code Online (Sandbox Code Playgroud)

lee*_*phi 5

我真的不确定为什么(你可以做更多的研究),但是把它放进去似乎可以使它工作!

webSettings.setDomStorageEnabled(true);
Run Code Online (Sandbox Code Playgroud)

我发现在这里:

错误/ Web控制台:未捕获的TypeError:无法在http://m.youtube.com/:844调用null的方法'getItem'