Android Webview: Cannot call determinedVisibility(

2019-01-09 05:05发布

I have a Android Webview and when I click on a link to download a file (image of pdf etc) I got a error message.

Error message:
Cannot call determinedVisibility() - never saw a connection for the pid

Any idea what I do wrong? Who can help please!?

11条回答
时光不老,我们不散
2楼-- · 2019-01-09 05:50

I found a workaround by using onPageFinished method instead of shouldOverrideUrlLoading. It also provides the needed URL in the list of arguments.

The only trick is to set a check so that the main logic of the method (in my case making a Toast) is not triggered when onPageFinished gets called on the the page load itself.

查看更多
Anthone
3楼-- · 2019-01-09 05:52

I got the same error and Burhans solution was not helping me. I think things went wrong when you´re trying to load different urls too fast.

Edit: Found a better solution credits go to user2652394 WebView must be loaded twice to load correctly

You have to do something like this:

        webView.postDelayed(new Runnable() {

            @Override
            public void run() {
                webView.loadUrl(landingpage);
            }
        }, 500);
查看更多
该账号已被封号
4楼-- · 2019-01-09 05:52
mWebView.setDownloadListener(new DownloadListener() {
  @Override
  public void onDownloadStart(String url, String userAgent, String contentDisposition, 
    String mimetype, long contentLength) {
    Log.d("download",url);
  }
});
查看更多
Luminary・发光体
5楼-- · 2019-01-09 06:00

I faced the same problem. I can fix my issue by giving this code:

webView.postDelayed(new Runnable() {
        @Override
        public void run() {
            webView.loadUrl(url);
        }
    }, 500);

instead of:

webview.loadUrl(url);

then, set the url starts with https://

查看更多
Animai°情兽
6楼-- · 2019-01-09 06:03

Check whether internet permission is properly set on the Manifest file. Make sure that the permission tag should be outside of your Application tag.

<uses-permission android:name="android.permission.INTERNET" />

Hope this might help some one.

查看更多
登录 后发表回答