I updated gradle for Googleplaces from 8.4.0 to 10.0.1
Using compile 'com.google.android.gms:play-services-places:10.0.1' . This gives me the prediction result as follows:
E/PlaceAutocomplete: ChIJARFGZy6_wjsRQ-Oenb9DjYI E/PlaceAutocomplete: ChIJCZRqkjTBwjsRtSBs09cqv5I E/PlaceAutocomplete: ChIJSXAo8VjAwjsR8XBJRuCZo0c E/PlaceAutocomplete: ChIJfxihRRy35zsRHL6ljyiIYKQ E/PlaceAutocomplete: ChIJFZ6g4SXG5zsRdAbRQFugDUk
for the city of Pune.
But in the previous gradle: compile 'com.google.android.gms:play-services-places:8.4.0' . It gives the correct city names.
How can I get the expected result?
I get the city name from the following code:
if (mGoogleApiClient != null) { mAdapter = new PlaceAutoCompleteAdapter(getActivity(), android.R.layout.simple_list_item_1, mGoogleApiClient, BOUNDS_GREATER_SYDNEY, null); place_from.setAdapter(mAdapter); place_to.setAdapter(mAdapter); place_from.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { final PlaceAutoCompleteAdapter.PlaceAutocomplete item = mAdapter.getItem(position); final String placeId = String.valueOf(item.placeId); Log.i("", "Autocomplete item selected: " + item.description); PendingResult<PlaceBuffer> placeResult = Places.GeoDataApi.getPlaceById(mGoogleApiClient, placeId); placeResult.setResultCallback(new ResultCallback<PlaceBuffer>() { @Override public void onResult(PlaceBuffer places) { if (!places.getStatus().isSuccess()) {
and using PlaceAutoCompleteAdapter
private static final String TAG = "PlaceAutocomplete"; private final GoogleApiClient mGoogleApiClient; private final AutocompleteFilter mPlaceFilter; private ArrayList<PlaceAutocomplete> mResultList; private LatLngBounds mBounds; public PlaceAutoCompleteAdapter(Context context, int resource, GoogleApiClient googleApiClient, LatLngBounds bounds, AutocompleteFilter filter) { super(context, resource); mGoogleApiClient = googleApiClient; mBounds = bounds; mPlaceFilter = filter; } public void setBounds(LatLngBounds bounds) { mBounds = bounds; } @Override public int getCount() { return mResultList.size(); } @Override public PlaceAutocomplete getItem(int position) { return mResultList.get(position); } @Override public Filter getFilter() { Filter filter = new Filter() { @Override protected FilterResults performFiltering(CharSequence constraint) { FilterResults results = new FilterResults();
source share