I'm getting the same issue using the CountDownLatch.  The WebView
can't load the url because of the lock.


On Jan 18, 11:01 am, Streets Of Boston <[email protected]>
wrote:
> We use a countdown latch instead:
>
> String returnValue;
> private CountDownLatch latch = null;
>
> public String run(String javaScript, int waitInMilliSecs) {
> latch = new CountDownLatch(1);
> runJS(javaScript); // this method just runs the given javascript in the
> WebView.
> try {
> latch.await(waitInMilliSecs, TimeUnit.MILLISECONDS);
>
> } catch (InterruptedException e) { } return returnValue;
> }
>
>  ...
>  ...
>
>  // method being called by the javascript in WebView
> public void setValue(String value) {
> try {
> // do your stuff here with 'value':
> returnValue = value;}
>
> finally {
> try { latch.countDown(); } catch (Exception e) {}
>
>
>
>
>
>
>
> }
> }

-- 
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

Reply via email to