My getJSValue() is run on the main thread as well. As far as the latch.await goes, If I run webView.loadUrl() in an asyncTask I get the full time out (10 seconds for testing). If I just run webView.loadUrl() in the current task, there is no time out. The latch.await call instantly comes back, but the return value doesn't get set until 180 milliseconds afterward. So I'm just instantly returning null.
If I remove latch.await, the javascript executes and the setValue is called. Just after the return has already happened. I'm returning true in my shouldOverrideUrlLoading method for some schemes, but this doesn't seem to be getting called for "javascript:" urls. On Jan 18, 12:21 pm, Streets Of Boston <[email protected]> wrote: > It's from a separate class (runJS does something like > mWebView.loadUrl(javaScriptUrl);) > > In my sample code, the *run *and *runJS *are usually executed on the main > UI thread (that's why there the *await *call has a (short) timeout). > The WebView's JavaScript execution's callback to Java (setValue in your > example) is done on a separate thread (managed by the WebView, i suppose). > > If you use my code, does the call to 'latch.await' time-out? > > If so, this means that the WebView never properly loaded the url (code) in > the loadUrl call. Look at your LogCat and see what may be the problem. > > Note that the WebView we use returns *false *for it's > WebViewClient's shouldOverrideUrlLoading method. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

