I saw a tutorial ( tutorial ) to find a city using autocomplete text view in android.i, did everything that was instructed, but now when I hit this URL
it always throws me an exception: java.net.UnknownHostException: Unable to resolve host "maps.googleapis.com": No address associated with hostname
but the same url works fine when I am in the browser and I get the results as well.
Here is the code I'm clicking on:
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) {
}
oops! Sorry guys. I found a solution that was a stupid mistake. I did not define the INTERNET permission in the manifest.
anshul
source share