geocoder.getLatLng() is an asynchronous method. Your callbacks from geocoder.getLatLng() will not going to have a chance to get called before your method "getAddress()" returns.
On Sat, Dec 5, 2009 at 1:12 PM, Andrea <[email protected]> wrote: > Hy. I have some problem with the geocoder class. > The method under return a empty lista otherwise if I put the > Window.alert("") the method return the correct result. > There is nobody that can help me? I want that the Arraylist return the > correct result without use Window.alert > Thanks Andrea > > public ArrayList<LatLng> getAddress(String address[]){ > geocoder.reset(); > lista.clear(); > for (int i = 0; i < address.length; i++) { > app=address[i]; > > geocoder.getLatLng(app, new LatLngCallback(){ > public void onFailure(){ > Window.alert(app + " not exist"); > } > public void onSuccess(LatLng point){ > lista.add(point); > map.addOverlay(new Marker(point)); > map.setCenter(point); > } > }); > } > lista.trimToSize(); > // Window.alert(""); > > return lista; > } > > -- > > 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]<google-web-toolkit%[email protected]> > . > 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 -- 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.
