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!?
Just a bit of configuration:
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setDomStorageEnabled(true);
Answer:
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);
Answer:
This problem in my case produce by incorrect settings in layout properties. I had used:
<WebView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/webView"
android:layout_below="@+id/textView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="false"
android:layout_alignWithParentIfMissing="false" />
Instead of setting:
<WebView
android:id="@+id/webView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/textView" />
The problems had been solved, when I removed “layout_alignParent” settings.
Answer:
Background
Here is the source code of the method in the browser engine that gives the error (BindingManagerImpl.java), from Chromium source:
@Override
public void determinedVisibility(int pid) {
ManagedConnection managedConnection;
synchronized (mManagedConnections) {
managedConnection = mManagedConnections.get(pid);
}
if (managedConnection == null) {
Log.w(TAG, "Cannot call determinedVisibility() - never saw a connection for the pid: "
+ "%d", pid);
return;
}
Analysis
It’s a rendering warning from content.
Consecutive calls to loadUrl
cause a race condition. The problem is that loadUrl("file://..")
doesn’t complete immediately, and so when you call loadUrl("javascript:..")
it will sometimes execute before
the page has loaded.
Detail
For more detail see this stackoverflow answer.
Answer:
I faced the same issue.
Was solved by giving a WebView a static height (ie 300dp) or specifying minHeight value.
Answer:
This is how I fixed a similar issue:
mWebView.setWebChromeClient(new WebChromeClient());
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setDomStorageEnabled(true);
mWebView.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view,String url) {
return false;
}
});
mWebView.loadURL(...
Answer:
Late to party, but might help some.
May sound silly as hell, but the mistake I made was not adding http://
in the beginning of the URL.
Answer:
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.
Answer:
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.
Answer:
mWebView.setDownloadListener(new DownloadListener() {
@Override
public void onDownloadStart(String url, String userAgent, String contentDisposition,
String mimetype, long contentLength) {
Log.d("download",url);
}
});
Answer:
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://