AutocompletePrediction
Stay organized with collections
Save and categorize content based on your preferences.
This interface is deprecated.
The Google Play Services Places SDK is deprecated. A new SDK is available.
See the client
migration guide for more information.
Represents a query's suggestions and its attributes, like matched substrings. For more
information about place autocomplete, see the developer's guide.
Inherited Method Summary
From interface
com.google.android.gms.common.data.Freezable
Public Methods
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"
If you do not wish to highlight matches, you can pass null.
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.
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.
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.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eAutocompletePrediction\u003c/code\u003e represents a place query's suggestions and attributes, including matched substrings, but is now deprecated along with the Google Play Services Places SDK.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers should refer to the client migration guide for information on the new SDK.\u003c/p\u003e\n"],["\u003cp\u003eThis interface provides methods to retrieve the full text, place ID, place types, primary text, and secondary text of a predicted place.\u003c/p\u003e\n"],["\u003cp\u003eIt is important to note that the \u003ccode\u003eAutocompletePrediction\u003c/code\u003e interface is part of the deprecated Google Play Services Places SDK and is no longer recommended for new development.\u003c/p\u003e\n"]]],["The `AutocompletePrediction` interface, now deprecated, represents query suggestions and their attributes. Key actions include retrieving a place's full, primary, and secondary text using `getFullText`, `getPrimaryText`, and `getSecondaryText` respectively. `getPlaceId` returns the unique identifier for a place, and `getPlaceTypes` returns the associated place type list. The interface includes methods to `freeze()` and verify if data is valid with `isDataValid()`. It also mentions the need to migrate to a new SDK.\n"],null,["# AutocompletePrediction\n\npublic interface **AutocompletePrediction** implements [Freezable](/android/reference/com/google/android/gms/common/data/Freezable)\\\u003c[AutocompletePrediction](/android/reference/com/google/android/gms/location/places/AutocompletePrediction)\\\u003e \n**This interface is deprecated.** \n\n**The Google Play Services Places SDK is deprecated.** A new SDK is available.\nSee the [client\nmigration guide](//developers.google.com/places/android-sdk/client-migration) for more information.\n\nRepresents a query's suggestions and its attributes, like matched substrings. For more\ninformation about place autocomplete, see [the developer's guide](//developers.google.com/places/android/autocomplete). \n\n### Public Method Summary\n\n|-----------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [CharSequence](//developer.android.com/reference/java/lang/CharSequence.html) | [getFullText](/android/reference/com/google/android/gms/location/places/AutocompletePrediction#getFullText(android.text.style.CharacterStyle))([CharacterStyle](//developer.android.com/reference/android/text/style/CharacterStyle.html) matchStyle) The full text of a place. |\n| abstract [String](//developer.android.com/reference/java/lang/String.html) | [getPlaceId](/android/reference/com/google/android/gms/location/places/AutocompletePrediction#getPlaceId())() Returns the place ID of the place being referred to by this prediction. |\n| abstract [List](//developer.android.com/reference/java/util/List.html)\\\u003c[Integer](//developer.android.com/reference/java/lang/Integer.html)\\\u003e | [getPlaceTypes](/android/reference/com/google/android/gms/location/places/AutocompletePrediction#getPlaceTypes())() Returns the list of place types associated with the place referred to by [getPlaceId()](/android/reference/com/google/android/gms/location/places/AutocompletePrediction#getPlaceId()). |\n| abstract [CharSequence](//developer.android.com/reference/java/lang/CharSequence.html) | [getPrimaryText](/android/reference/com/google/android/gms/location/places/AutocompletePrediction#getPrimaryText(android.text.style.CharacterStyle))([CharacterStyle](//developer.android.com/reference/android/text/style/CharacterStyle.html) matchStyle) The primary text of a place. |\n| abstract [CharSequence](//developer.android.com/reference/java/lang/CharSequence.html) | [getSecondaryText](/android/reference/com/google/android/gms/location/places/AutocompletePrediction#getSecondaryText(android.text.style.CharacterStyle))([CharacterStyle](//developer.android.com/reference/android/text/style/CharacterStyle.html) matchStyle) The secondary text of a place. |\n\n### Inherited Method Summary\n\nFrom interface com.google.android.gms.common.data.Freezable \n\n|---------------------------------------------------------------------------------------------------------------------|---------------|\n| abstract [AutocompletePrediction](/android/reference/com/google/android/gms/location/places/AutocompletePrediction) | freeze() |\n| abstract boolean | isDataValid() |\n\nPublic Methods\n--------------\n\n#### public abstract [CharSequence](//developer.android.com/reference/java/lang/CharSequence.html)\n**getFullText** ([CharacterStyle](//developer.android.com/reference/android/text/style/CharacterStyle.html) matchStyle)\n\nThe full text of a place. This is a combination of the primary text and the\nsecondary text.\n\nExample: \"Eiffel Tower, Avenue Anatole France, Paris, France\"\n\nIf you do not wish to highlight matches, you can pass null. \n\n#### public abstract [String](//developer.android.com/reference/java/lang/String.html) **getPlaceId** ()\n\nReturns the place ID of the place being referred to by this prediction. For more\ninformation on place IDs, see [the\nplace ID overview](//developers.google.com/places/place-id). \n\n#### public abstract [List](//developer.android.com/reference/java/util/List.html)\\\u003c[Integer](//developer.android.com/reference/java/lang/Integer.html)\\\u003e\n**getPlaceTypes** ()\n\nReturns the list of place types associated with the place referred to by\n[getPlaceId()](/android/reference/com/google/android/gms/location/places/AutocompletePrediction#getPlaceId()). For more information on place types, see [the place types overview](//developers.google.com/places/supported_types). \n\n#### public abstract [CharSequence](//developer.android.com/reference/java/lang/CharSequence.html)\n**getPrimaryText** ([CharacterStyle](//developer.android.com/reference/android/text/style/CharacterStyle.html) matchStyle)\n\nThe primary text of a place. This will usually be the name of the place.\n\nExample: \"Eiffel Tower\", \"123 Pitt Street\"\n\nSee [getFullText(CharacterStyle)](/android/reference/com/google/android/gms/location/places/AutocompletePrediction#getFullText(android.text.style.CharacterStyle)) for more information on formatting. \n\n#### public abstract [CharSequence](//developer.android.com/reference/java/lang/CharSequence.html)\n**getSecondaryText** ([CharacterStyle](//developer.android.com/reference/android/text/style/CharacterStyle.html) matchStyle)\n\nThe secondary text of a place. This provides extra context on the place, and can be\nused as a second line when showing autocomplete predictions.\n\nExample: \"Avenue Anatole France, Paris, France\", \"Sydney, New South Wales\"\n\nSee [getFullText(CharacterStyle)](/android/reference/com/google/android/gms/location/places/AutocompletePrediction#getFullText(android.text.style.CharacterStyle)) for more information on formatting."]]