LocalitiesAdapter

open class LocalitiesAdapter @JvmOverloads constructor(context: Context, val resource: Int, var types: List<LocalitiesTypes>? = null, var componentsCountries: List<String>? = null, var language: String? = null, var location: LatLng? = null, var radius: Int? = null, var data: Data? = null, var customDescription: Map<LocalitiesTypes, String>? = null) : ArrayAdapter<LocalitiesAutocompleteResponse>

You can use this adapter to provide views for an AdapterView. Returns a view for each results returned by LocalitiesService.localitiesAutocomplete and can be used with list-based user interface widgets such as ListView or Spinner.

By default, the array adapter creates a view by calling LocalitiesAutocompleteResponse.description on each autocomplete results and places the result in a TextView. You may also customize what type of view is used for the data object in the collection. To customize what type of view is used for the data object, override LocalitiesAdapter.getView and inflate a view resource.

For an example of using an array adapter with a ListView, see the Adapter Views guide.

Parameters

componentsCountries

A grouping of countries to which you would like to restrict your results. Countries must be passed as an ISO 3166-1 Alpha-2 or Alpha-3 compatible country code. For example: fr or fra would restrict your results to places within France. (optional) You can use Locale to get proper codes. For example: listOf(Locale.FRANCE.isO3Country, Locale.UK.isO3Country)

Constructors

Link copied to clipboard
constructor(context: Context, resource: Int, types: List<LocalitiesTypes>? = null, componentsCountries: List<String>? = null, language: String? = null, location: LatLng? = null, radius: Int? = null, data: Data? = null, customDescription: Map<LocalitiesTypes, String>? = null)

Properties

Link copied to clipboard
Link copied to clipboard

This parameter allows to choose the description format for all or some of the suggestion types selected. The custom formats are described as follows (available fields depend on the returned type). For example: mapOf(LocalitiesTypes.Locality to "{name} - {administrative_area_level_0}")

Link copied to clipboard
var data: Data?

By default, if the parameter is not defined, value is set as LocalitiesService.Data.Standard. The LocalitiesService.Data.Advanced value opens suggestions to worldwide postal codes in addition to postal codes for Western Europe. A dedicated option subject to specific billing on your license is needed to use this parameter. Please contact us if you are interested in using this parameter and you do not have subscribed the proper option yet.

Link copied to clipboard

The language code, using ISO 3166-1 Alpha-2 or Alpha-3 country codes, indicating in which language the results should be returned, if possible. If language is not supplied, the Localities service will use english as default language. No language necessary for postal_code request. For example: Locale.FRANCE.isO3Country

Link copied to clipboard

This parameter is used to add a bias to the autocomplete feature. The location defines the point around which to retrieve results in priority. It must be specified with a LatLng.

Link copied to clipboard
var radius: Int?

This parameter may be used in addition to the location parameter to define the distance in meters within which the API will return results in priority. Results outside of the defined area may still be displayed. Default radius if this parameter is not set is 100 000.

Link copied to clipboard

An Android Resource. For example: R.layout.simple_dropdown_item_1line

Link copied to clipboard

The types of suggestion to return. Not specifying any type will only query LocalitiesTypes.Locality and LocalitiesTypes.PostalCode.

Functions

Link copied to clipboard
open override fun getFilter(): Filter

Returns a filter that can be used to constrain data with a filtering pattern.

Link copied to clipboard
open override fun getView(position: Int, convertView: View?, parent: ViewGroup): View

Get a View that displays the data at the specified position in the data set.