9
I have seen the tutorial( tutorial ) to find the city using autocomplete text view in android.i have done everything that is instructed but now when i hit this url
it always throws me an exception saying : java.net.UnknownHostException: Unable to resolve host "maps.googleapis.com": No address associated with hostname
but the same url work fine when i hit through browser and i am getting the results also.
Here is the code i m hitting with :
public class PlacesAutoCompleteAdapter extends ArrayAdapter< String > implements Filterable{
private ArrayList<String> resultList;
private static final String LOG_TAG = "ExampleApp";
private static final String PLACES_API_BASE = "https://maps.googleapis.com/maps/api/place";
private static final String TYPE_AUTOCOMPLETE = "/autocomplete";
private static final String OUT_JSON = "/json";
private static final String API_KEY = "I have generated the correct api key also";
public PlacesAutoCompleteAdapter(Context context, int textViewResourceId) {
super(context, textViewResourceId);
}
@Override
public int getCount() {
return resultList.size();
}
@Override
public String getItem(int index) {
return resultList.get(index);
}
@Override
public Filter getFilter() {
Filter filter = new Filter() {
@Override
protected FilterResults performFiltering(CharSequence constraint) {
FilterResults filterResults = new FilterResults();
if (constraint != null) {
// Retrieve the autocomplete results.
resultList = autocomplete(constraint.toString());
// Assign the data to the FilterResults
filterResult