Thanks for your answer.

It's only few days that I use this technology so please tell me how I
can make my RPC call takes the entire list at once.
I can't understand the first solution, can you give me an example of
it??

Andrea

On 29 Mar, 17:54, kozura <[email protected]> wrote:
> Hi Andrea,
> I assume you mean the listaCoordinateCittaUtente list doesn't have any
> data after this call?  This is the point of an asynchronous call, you
> can't predict how long the call will take to come back from the
> server, so you actually need to design your app to use the data only
> once it is completed.  It looks like you sortof do that with
> map.addOverlay, where you're doing something to your map is once the
> call comes back; you need to consider the list in the same way.  In
> this case, it won't have the complete result until onSuccess has been
> called nCicli times.
>
> Also, if there really are many addresses, you would be much better off
> making your RPC call take the entire list at once.  For one, there are
> only two connections allowed at a time, so making many calls will
> quickly cause a bottleneck - one call will be much more efficient than
> many.  For two, I'm assuming you actually want to associate these
> returned points with their addresses.  There is no guarantee of the
> order that onSuccess will be called with the return values, so even
> once it is completely filled, lista... list won't be in the same order
> as the address array.  Finally, with one call you'll actually know for
> sure when the operation is done - the single call of onSuccess.
>
> jk
>
> On Mar 29, 9:39 am, Andrea <[email protected]> wrote:
>
>
>
> > I have the method getAddress() that take in input an array of cities.
> > For each city I use the Asyncronous method getLatLng() that return me
> > the coordinates and I save them in an ArrayList called
> > listaCoordinateCittaUtente.
> > But when I use the ArrayList after the call of the method getAddress()
> > it is empty.
> > I tried to resolve this problem with the Timer class but it isn't the
> > better solution.
> > How can I resolve this problem???
>
> > public void getAddress(String address[]){
> >       final int nCicli=address.length;
>
> >        for (int i = 0; i < nCicli; i++) {
> >          final String nomeCitta=address[i];
> >                  geocoder.getLatLng(nomeCitta, new LatLngCallback(){
> >          public void onFailure(){
> >                  Window.alert(nomeCitta + " non esiste");
> >          }
> >          public void onSuccess(LatLng point){
> >                  listaCoordinateCittaUtente.add(point);
> >                  map.addOverlay(new Marker(point));
> >                  map.setCenter(point);
> >          }
> >          });
> >         }
> >  }- Nascondi testo citato
>
> - Mostra testo citato -

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" 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/google-web-toolkit?hl=en.

Reply via email to