public class

PlacePicker

extends Object
java.lang.Object
   ↳ com.google.android.gms.location.places.ui.PlacePicker

Class Overview

The Place Picker UI is a dialog that allows a user to pick a Place using an interactive map.

Users can select the place they are at, or a place nearby. Apps can also initialize the map to a particular viewport.

Summary

Nested Classes
class PlacePicker.IntentBuilder Builder for a Place Picker launch intent. 
Constants
int RESULT_ERROR Indicates that an error occurred.
Public Constructors
PlacePicker()
Public Methods
static String getAttributions(Intent intent)
Returns an HTML string with required attributions that must be shown whenever the data in the selected Place is used.
static LatLngBounds getLatLngBounds(Intent intent)
Returns the last LatLngBounds of the map if a selection was made.
static Place getPlace(Intent intent, Context context)
Retrieves the selected Place from the result intent.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int RESULT_ERROR

Indicates that an error occurred.

Constant Value: 2 (0x00000002)

Public Constructors

public PlacePicker ()

Public Methods

public static String getAttributions (Intent intent)

Returns an HTML string with required attributions that must be shown whenever the data in the selected Place is used. Please refer to the developer's guide for more information about attribution. One easy way to render this content is with a TextView:

     String attributions = PlacePicker.getAttributions(selectedPlace);
     TextView attributionsTextView = findViewById(R.id.attributions);
     attributionsTextView.setText(Html.fromHtml(attributions))
 

public static LatLngBounds getLatLngBounds (Intent intent)

Returns the last LatLngBounds of the map if a selection was made.

public static Place getPlace (Intent intent, Context context)

Retrieves the selected Place from the result intent.

Returns
  • The selected Place or null if no selection was made