I think you can trace what's going on by putting in a few calls to
Window.alert().  The calls to getLatLng() have to go across to
Google's servers and may take many milliseconds to return.  You need
some kind of mechanism to make sure all of the LatLngCallbacks fire
before looking at listaCoordinateCittaUtente

On Mon, Mar 29, 2010 at 11:39 AM, Andrea <andrea.mor...@gmail.com> 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);
>         }
>         });
>        }
>  }
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>



-- 
Eric Z. Ayers
Google Web Toolkit, Atlanta, GA USA
Sign up now for Google I/O 2010: May 19-20, http://code.google.com/io

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to