My problem is, this method is returning the list before the ajax fill that.
How can I wait for the ajax response, before return the list?
GEOCODER:
public List<Address> getAddresses(String address) {
List<Address> addresses = new ArrayList<Address>();
String url = "http://maps.googleapis...";
AQuery aq = new AQuery(context);
aq.ajax(...); //Here I fill the addresses list
return addresses;
}
Put aq.ajax() in different method/function and when ajax call get successfully completed in that method/function,then return the results to this method/function and then return those results from this method/function.