BasicPlaceAutocomplete

public static class BasicPlaceAutocomplete


The BasicPlaceAutocomplete creates a launch intent for an activity that allows a user to start typing a place name or an address, and see place predictions appear as they type.

If the user exits the activity without choosing a place, the calling activity will receive BasicPlaceAutocompleteActivity.RESULT_CANCELED. If there is an error, the calling activity will receive BasicPlaceAutocompleteActivity.RESULT_ERROR. If the user selects a place, the calling activity will receive BasicPlaceAutocompleteActivity.RESULT_OK and the selected Place can be retrieved using BasicPlaceAutocomplete.getPlaceFromIntent.

Summary

Nested types

Builder for an intent to launch the activity.

Public fields

static @NonNull BasicPlaceAutocomplete

Public methods

final @NonNull Intent

Creates an intent to launch the activity.

static final Place

Returns the Place selected by the user if the activity finished with a successful selection.

static final Status

Returns the Status associated with the intent.

Public fields

INSTANCE

public static @NonNull BasicPlaceAutocomplete INSTANCE

Public methods

createIntent

public final @NonNull Intent createIntent(
    @NonNull Context context,
    @ExtensionFunctionType Function1<@NonNull BasicPlaceAutocomplete.IntentBuilderUnit> actions
)

Creates an intent to launch the activity.

getPlaceFromIntent

public static final Place getPlaceFromIntent(@NonNull Intent intent)

Returns the Place selected by the user if the activity finished with a successful selection.

The Place only contains the Place.id.

Parameters
@NonNull Intent intent

The result Intent after BasicPlaceAutocompleteActivity finishes.

Returns
Place

The user's selected Place or null if the activity finished with an error or was canceled.

getResultStatusFromIntent

public static final Status getResultStatusFromIntent(@NonNull Intent intent)

Returns the Status associated with the intent. Note that this may return null if the activity hasn't finished.

Parameters
@NonNull Intent intent

The result Intent after BasicPlaceAutocompleteActivity finishes.

Returns
Status

The Status associated with the intent.