Why does your JS has to be synchronous?

Simply within JS make <body> of your page a throbber and only swap it
back to its actual content as a last statement in the JS function that
you want to process.



On 18 January 2012 16:24, tatebn <[email protected]> wrote:
> 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



-- 
Daniel Drozdzewski

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