Android APIs
public interface

AutocompletePrediction

implements Freezable<AutocompletePrediction>
com.google.android.gms.location.places.AutocompletePrediction

Class Overview

Represents a query's suggestions and its attributes, like matched substrings. For more information about place autocomplete, see the developer's guide.

Summary

Nested Classes
interface AutocompletePrediction.Substring This interface is deprecated. Please use getFullText(CharacterStyle) to format matches more easily  
Public Methods
abstract String getDescription()
This method is deprecated. Please use getFullText(CharacterStyle) to format matches more easily
abstract CharSequence getFullText(CharacterStyle matchStyle)
The full text of a place.
abstract List<? extends AutocompletePrediction.Substring> getMatchedSubstrings()
This method is deprecated. Please use getFullText(CharacterStyle) to format matches more easily
abstract String getPlaceId()
Returns the place ID of the place being referred to by this prediction.
abstract List<Integer> getPlaceTypes()
Returns the list of place types associated with the place referred to by getPlaceId().
abstract CharSequence getPrimaryText(CharacterStyle matchStyle)
The primary text of a place.
abstract CharSequence getSecondaryText(CharacterStyle matchStyle)
The secondary text of a place.
[Expand]
Inherited Methods
From interface com.google.android.gms.common.data.Freezable

Public Methods

public abstract String getDescription ()

This method is deprecated.
Please use getFullText(CharacterStyle) to format matches more easily

The description of a predicted place.

Examples:

    Tacoma, Washington
      Taco Bell, Willitis, CA

public abstract CharSequence getFullText (CharacterStyle matchStyle)

The full text of a place. This is a combination of the primary text and the secondary text.

Example: "Eiffel Tower, Avenue Anatole France, Paris, France"

This method is equivalent to getDescription(), but it also lets you highlight matches with the style of your choice.

If you do not wish to highlight matches, you can pass null.

public abstract List<? extends AutocompletePrediction.Substring> getMatchedSubstrings ()

This method is deprecated.
Please use getFullText(CharacterStyle) to format matches more easily

Get a list of matched substrings in a query suggestion's description.

Each AutocompletePrediction.Substring contains an offset value and a length. These describe the location of the entered term in the prediction result text, so that the term can be highlighted if desired.

Returns
  • a list of matched substrings in a query suggestion's description.

public abstract String getPlaceId ()

Returns the place ID of the place being referred to by this prediction. For more information on place IDs, see the place ID overview.

public abstract List<Integer> getPlaceTypes ()

Returns the list of place types associated with the place referred to by getPlaceId(). For more information on place types, see the place types overview.

public abstract CharSequence getPrimaryText (CharacterStyle matchStyle)

The primary text of a place. This will usually be the name of the place.

Example: "Eiffel Tower", "123 Pitt Street"

See getFullText(CharacterStyle) for more information on formatting.

public abstract CharSequence getSecondaryText (CharacterStyle matchStyle)

The secondary text of a place. This provides extra context on the place, and can be used as a second line when showing autocomplete predictions.

Example: "Avenue Anatole France, Paris, France", "Sydney, New South Wales"

See getFullText(CharacterStyle) for more information on formatting.