title: Places.GeoDataApi.getAutocompletePredictions
body: <p>I'm having problems with Android Google Places API - auto complete feature.</p>
  
  <p>I'm trying to use <a href="https://developers.google.com/android/reference/com/google/android/gms/location/places/GeoDataApi?hl=zh-tw#getAutocompletePredictions(com.google.android.gms.common.api.GoogleApiClient,%20java.lang.String,%20com.google.android.gms.maps.model.LatLngBounds,%20com.google.android.gms.location.places.AutocompleteFilter)" rel="nofollow noreferrer">Places.GeoDataApi.getAutocompletePredictions()</a> method to get the placeId, however, it doesn't work.(The output doesn't even show "can't get the value")
  Could anyone help me?</p>
  
  <p>Here is my Java code:</p>
  
  <pre><code> PendingResult&lt;AutocompletePredictionBuffer&gt; result =
              Places.GeoDataApi.getAutocompletePredictions(mGoogleApiClient, query,
                      mLatLonBounds, null);
  
      result.setResultCallback(new ResultCallback&lt;AutocompletePredictionBuffer&gt;() {
          @Override
          public void onResult(@NonNull AutocompletePredictionBuffer autocompletePredictions) {
  
              if (autocompletePredictions.getStatus().isSuccess()) { //如果回傳SUCCESS
  
                  Iterator&lt;AutocompletePrediction&gt; iterator = autocompletePredictions.iterator();
                  resultList = new ArrayList&lt;&gt;(autocompletePredictions.getCount());
  
                  while (iterator.hasNext()) {
                      AutocompletePrediction prediction = iterator.next();
                      resultList.add(prediction.getPlaceId().toString());
                  }
              }
             else {
                  resultList.add("can't get the vaule");
              }
              autocompletePredictions.release();
          }
  
      });
  
   textView.setText(resultList.get(0).toString());
  </code></pre>
  
  <p>Thanks.</p>