public class SnapToPlacePicker
extends AppCompatActivity
void pickPlace() {
Intent i = new Intent(this, SnapToPlacePicker.class);
startActivityForResult(i, 9001);
}
You can customize the picker by adding some optional extras to the Intent. Use EXTRA_QUERY to pass in a query
to start the search with. User EXTRA_HIDE_LOCATION_CHANGE to remove the change location input.
Finally, use EXTRA_HEADER_BACKGROUND_RESOURCE to customize the background behind the search box.
When your user has selected a place, the picker will close and your calling activity will be called and you can extract the place picked.
if (resultCode == SnapToPlacePicker.PLACE_PICKED_RESULT_CODE) {
Venue place = data.getParcelableExtra(SnapToPlacePicker.EXTRA_PLACE);
}| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
EXTRA_HEADER_BACKGROUND_RESOURCE |
static java.lang.String |
EXTRA_HIDE_LOCATION_CHANGE |
static java.lang.String |
EXTRA_PLACE
Extra key for the result Intent in onActivityResult
|
static java.lang.String |
EXTRA_QUERY
UI Extras
|
static int |
PLACE_PICKED_RESULT_CODE
Result code returned when a place is selected in the list
|
| Constructor and Description |
|---|
SnapToPlacePicker() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
onCreate(android.os.Bundle savedInstanceState) |
protected void |
onDestroy() |
public static final int PLACE_PICKED_RESULT_CODE
public static final java.lang.String EXTRA_PLACE
public static final java.lang.String EXTRA_QUERY
public static final java.lang.String EXTRA_HIDE_LOCATION_CHANGE
public static final java.lang.String EXTRA_HEADER_BACKGROUND_RESOURCE