Webview没有从数组

时间:2017-11-06 18:16:01

标签: java android webview

当我运行时,webview不会加载,而只显示白屏。该数组是URLS列表。 Logcat显示此错误

  

11-06 23:36:40.879 25145-25145 / live.randomize.abhi.randomize   I / cr_BrowserStartup:初始化铬过程,   singleProcess = false 11-06 23:36:40.888   25145-25238 / live.randomize.abhi.randomize W / cr_ChildProcLauncher:   使用包名=创建一个新的ChildConnectionAllocator   com.android.chrome,inSandbox = true 11-06 23:36:40.912   25145-25145 / live.randomize.abhi.randomize D / EGL_emulation:   eglCreateContext:0xa46fdc20:maj 2 min 0 rcv 2 11-06 23:36:40.913   25145-25145 / live.randomize.abhi.randomize D / EGL_emulation:   eglMakeCurrent:0xa46fdc20:ver 2 0(tinfo 0xa43334d0)11-06   23:36:41.179 25145-25145 / live.randomize.abhi.randomize W / zygote:   尝试删除非JNI本地引用,转储线程11-06   23:36:41.195 25145-25225 / live.randomize.abhi.randomize   D / EGL_emulation:eglMakeCurrent:0xb45a1a40:ver 2 0(tinfo   0xa4226770)11-06 23:36:41.293   25145-25145 / live.randomize.abhi.randomize W / zygote:尝试删除   非JNI本地引用,转储线程11-06 23:36:42.652   25145-25145 / live.randomize.abhi.randomize W / zygote:尝试删除   非JNI本地引用,转储线程11-06 23:36:42.695   25145-25145 / live.randomize.abhi.randomize I / chatty:uid = 10083(u0_a83)   live.randomize.abhi.randomize相同的1行11-06 23:36:42.727   25145-25145 / live.randomize.abhi.randomize W / zygote:尝试删除   非JNI本地引用,转储线程11-06 23:36:42.844   25145-25145 / live.randomize.abhi.randomize W / zygote:尝试删除   非JNI本地引用,转储线程11-06 23:36:42.925   25145-25145 / live.randomize.abhi.randomize I / chatty:uid = 10083(u0_a83)   live.randomize.abhi.randomize相同的1行11-06 23:36:42.989   25145-25145 / live.randomize.abhi.randomize W / zygote:尝试删除   非JNI本地参考,dumpin

这是代码: - 任何帮助?是的,我在Manifest中有INTERNET许可。

private String[] array;
private WebView myWebView;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    array = getApplicationContext().getResources().getStringArray(R.array.myArray);
    final String randomStr = array[new Random().nextInt(array.length)];
    {
        myWebView = (WebView) findViewById(R.id.myWebView);
        WebSettings webSettings = myWebView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        webSettings.setBuiltInZoomControls(true);
        webSettings.setUseWideViewPort(true);
        myWebView.getSettings().setDomStorageEnabled(true);

        webSettings.setLoadWithOverviewMode(true);
        myWebView.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView View, WebResourceRequest request)

            {   myWebView.loadUrl(randomStr);
                return true;
            }
        });
    }
}

1 个答案:

答案 0 :(得分:0)

使用此 -

table.rows