@Override
        public void onResult(PlaceBuffer places) {
          if (!places.getStatus().isSuccess()) {
            // Request did not complete successfully
            Log.e(TAG, "Place query did not complete. Error: " + places.getStatus().toString());
            places.release();
            return;
          }

          // Get the Place object from the buffer
          final Place place = places.get(0);

          // Format details of the place for display and show it in a TextView
          mPlaceDetailsText.setText(
              formatPlaceDetails(getResources(), place.getName(), place.getAddress()));
          mPlaceDetailsText.setVisibility(View.VISIBLE);

          // Make add to itinerary button visible and pass the place name to its onClickListener
          mPlaceButton.setOnClickListener(new addtoItinerary(place.getName()));
          mPlaceButton.setVisibility(View.VISIBLE);

          Log.i(TAG, "Place details received: " + place.getName());

          places.release(); // release the buffer
        }
Ejemplo n.º 2
0
        @Override
        public void onResult(PlaceBuffer places) {
          if (!places.getStatus().isSuccess()) {
            // Request did not complete successfully
            Log.e(TAG, "Place query did not complete. Error: " + places.getStatus().toString());
            places.release();
            return;
          }
          // Get the Place object from the buffer.
          final Place place = places.get(0);

          Log.i(TAG, "Place details received: " + place.getName());

          places.release();
        }
Ejemplo n.º 3
0
        @Override
        public void onResult(PlaceBuffer places) {
          if (!places.getStatus().isSuccess()) {
            // Request did not complete successfully

            return;
          }
          // Get the Place object from the buffer.
          final Place place = places.get(0);

          // Format details of the place for display and show it in a TextView.
          mAutocompleteView.setText(place.getAddress());
          inputLocation.setAddress(place.getAddress().toString());
          inputLocation.setLatitude(place.getLatLng().latitude);
          inputLocation.setLongitude(place.getLatLng().longitude);
          inputLocation.setAccuracy(10);
        }
        @Override
        public void onResult(PlaceBuffer places) {
          if (!places.getStatus().isSuccess()) {
            // Request did not complete successfully
            Log.e(TAG, "Place query did not complete. Error: " + places.getStatus().toString());
            places.release();
            return;
          }
          // Get the Place object from the buffer.
          final Place place = places.get(0);
          mPickedLatLng = place.getLatLng();
          // Format details of the place for display and show it in a TextView.

          MarkerOptions options = new MarkerOptions().position(mPickedLatLng).title("I am here!");
          mGoogleMap.addMarker(options);
          mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(mPickedLatLng, 15));

          Log.i(TAG, "Place details received: " + place.getName());
          places.release();
        }
 @Override
 public void onResult(PlaceBuffer places) {
   if (!places.getStatus().isSuccess()) {
     // Request did not complete successfully
     Log.e(TAG, "Place query did not complete. Error: " + places.getStatus().toString());
     places.release();
     return;
   }
   // Get the Place object from the buffer.
   final Place place = places.get(0);
   // Format details of the place for display and show it in a TextView.
   mPlaceDetailsText.setText(
       formatPlaceDetails(
           getResources(),
           place.getName(),
           place.getId(),
           place.getAddress(),
           place.getPhoneNumber(),
           place.getWebsiteUri()));
   // Display the third party attributions if set.
   final CharSequence thirdPartyAttribution = places.getAttributions();
   if (thirdPartyAttribution == null) {
     mPlaceDetailsAttribution.setVisibility(View.GONE);
   } else {
     mPlaceDetailsAttribution.setVisibility(View.VISIBLE);
     mPlaceDetailsAttribution.setText(Html.fromHtml(thirdPartyAttribution.toString()));
   }
   Log.i(TAG, "Place details received: " + place.getName());
   places.release();
 }
Ejemplo n.º 6
0
        @Override
        public void onResult(PlaceBuffer places) {
          if (!places.getStatus().isSuccess()) {
            // Request did not complete successfully
            Log.e("TAG", "Place query did not complete. Error: " + places.getStatus().toString());
            places.release();
            return;
          }
          // Get the Place object from the buffer.
          final Place place = places.get(0);

          // Format details of the place for display and show it in a TextView.

          Intent info = new Intent(getActivity(), MapsActivity.class);
          info.putExtra("latitude", place.getLatLng().latitude);
          info.putExtra("longitude", place.getLatLng().longitude);
          info.putExtra("name", place.getName());
          Log.i("place", place.getLatLng().toString());
          getActivity().startActivity(info);

          places.release();
        }