We use a countdown latch instead:

private CountDownLatch latch = null;

public void 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) { } 
}

 ...
 ...

 // method being called by the javascript in WebView
public void setValue(String value) {
try {
// do your stuff here with '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