@Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
          /*
          Retrieve the place ID the selected item from the Adapter
          Each Place suggestion is stored as an AutocompletePrediction
          in the Adapter
           */

          final AutocompletePrediction item = mPlaceAdapter.getItem(position);
          final String placeId = item.getPlaceId();
          final CharSequence primaryText = item.getPrimaryText(null);

          Log.i(TAG, "Autocomplete item selected: " + primaryText);

          /*
          Issue a request to the Places Geo Data API to retrieve a Place object with
          additional details about the place
           */
          PendingResult<PlaceBuffer> placeResult =
              Places.GeoDataApi.getPlaceById(mGoogleApiClient, placeId);
          placeResult.setResultCallback(mUpdatePlaceDetailsCallback);

          mAutocompleteView.setText(primaryText);

          Log.i(TAG, "Called getPlaceById to get Place details for " + placeId);
        }
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
          /*
          Retrieve the place ID of the selected item from the Adapter.
          The adapter stores each Place suggestion in a PlaceAutocomplete object from which we
          read the place ID.
          */
          final PlaceAutocompleteAdapter.PlaceAutocomplete item = mAdapter.getItem(position);
          final String placeId = String.valueOf(item.placeId);
          Log.i(TAG, "Autocomplete item selected: " + item.description);

          PendingResult<PlaceBuffer> placeResult =
              Places.GeoDataApi.getPlaceById(mGoogleApiClient, placeId);

          placeResult.setResultCallback(mPlacePickedChangeMap);
        }
예제 #3
0
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
          /*
          Retrieve the place ID of the selected item from the Adapter.
          The adapter stores each Place suggestion in a PlaceAutocomplete object from which we
          read the place ID.
           */
          final PlaceAutocompleteAdapter.PlaceAutocomplete item = mAdapter.getItem(position);
          final String placeId = String.valueOf(item.placeId);
          Log.i("Input place", "Autocomplete item selected: " + item.description);

          /*
          Issue a request to the Places Geo Data API to retrieve a Place object with additional
           details about the place.
           */
          PendingResult<PlaceBuffer> placeResult =
              Places.GeoDataApi.getPlaceById(mGoogleApiClient, placeId);
          placeResult.setResultCallback(mUpdatePlaceDetailsCallback);
          Log.i("Input place", "Called getPlaceById to get Place details for " + item.placeId);
        }