public class GeocoderAdapter extends BaseAdapter implements Filterable
GeocoderAutoCompleteView
. In this class we make the Mapbox Geocoding API
call.IGNORE_ITEM_VIEW_TYPE, NO_SELECTION
Constructor and Description |
---|
GeocoderAdapter(Context context) |
Modifier and Type | Method and Description |
---|---|
void |
cancelApiCall()
Can be used to cancel any calls currently in progress.
|
String |
getAccessToken()
Get the access token used with making the Mapbox geocoding API call.
|
String |
getBaseUrl()
Get the base url of the API.
|
double[] |
getBbox()
Bounding box within which to limit results
|
int |
getCount()
Gives How many items are in the data set represented by this Adapter.
|
String[] |
getCountries()
Get the countries you are limiting your geocoding results if applicable.
|
String |
getCountry()
Get the country you are limiting your geocoding results if applicable.
|
Filter |
getFilter()
Returns a filter that can be used to constrain data with a filtering pattern.
|
com.mapbox.services.api.geocoding.v5.models.CarmenFeature |
getItem(int position)
Get the data item associated with the specified position in the data set.
|
long |
getItemId(int position)
Get the row id associated with the specified position in the list.
|
String |
getLanguage() |
int |
getLimit()
Returns integer number representing the amount of results
|
com.mapbox.services.commons.models.Position |
getProximity()
Location around which to bias geocoder results.
|
String |
getType()
Get the geocoder filter type.
|
String[] |
getTypes()
Get the geocder filter types in a String array.
|
View |
getView(int position,
View convertView,
ViewGroup parent)
Get a View that displays the data at the specified position in the data set.
|
void |
setAccessToken(String accessToken)
You'll need to have a Mapbox access token to use the geocoding API within MAS.
|
void |
setBaseUrl(String baseUrl)
Set the base url of the API.
|
void |
setBbox(double minX,
double minY,
double maxX,
double maxY)
Bounding box within which to limit results.
|
void |
setBbox(com.mapbox.services.commons.models.Position northeast,
com.mapbox.services.commons.models.Position southwest)
Bounding box within which to limit results.
|
void |
setCountries(String[] countries)
Parameter limits results to a set of one or more countries.
|
void |
setCountry(String country)
Parameter limits results to a country.
|
void |
setLanguage(String language)
The locale in which results should be returned.
|
void |
setLimit(int limit)
Limit the number of results returned.
|
void |
setProximity(com.mapbox.services.commons.models.Position position)
Location around which to bias geocoder results.
|
void |
setType(String type)
Configure the geocoder type, pass in one of the constants found within
GeocodingCriteria . |
void |
setTypes(String[] types)
Configure the geocoder type, pass in one or more of the constants found within
GeocodingCriteria . |
areAllItemsEnabled, getDropDownView, getItemViewType, getViewTypeCount, hasStableIds, isEmpty, isEnabled, notifyDataSetChanged, notifyDataSetInvalidated, registerDataSetObserver, unregisterDataSetObserver
public GeocoderAdapter(Context context)
public String getBaseUrl()
public void setBaseUrl(String baseUrl)
baseUrl
- base url used as end pointpublic String getAccessToken()
public void setAccessToken(String accessToken)
accessToken
- Your Mapbox access tokenpublic String getCountry()
public void setCountry(String country)
country
- String matching country code.public String[] getCountries()
public void setCountries(String[] countries)
countries
- String array containing the country codes you want to limit results to.public String getType()
public String[] getTypes()
public void setType(String type)
GeocodingCriteria
.type
- String containing "place", "poi", "neighborhood", etc.public void setTypes(String[] types)
GeocodingCriteria
.types
- String array containing "place", "poi", "neighborhood", etc.public double[] getBbox()
public void setBbox(com.mapbox.services.commons.models.Position northeast, com.mapbox.services.commons.models.Position southwest)
northeast
- The top right hand corner of your bounding box when the map is pointed north.southwest
- The bottom left hand corner of your bounding box when the map is pointed north.public void setBbox(double minX, double minY, double maxX, double maxY)
minX
- Bottom of bounding box when map is pointed north.minY
- Left of bounding box when map is pointed north.maxX
- Top of bounding box when map is pointed north.maxY
- Right of bounding box when map is pointed north.public com.mapbox.services.commons.models.Position getProximity()
Position
coordinate.public void setProximity(com.mapbox.services.commons.models.Position position)
position
- Position
coordinate.public int getLimit()
public void setLimit(int limit)
limit
- the integer value representing the amount of results desired.public String getLanguage()
public void setLanguage(String language)
This property affects the language of returned results; generally speaking, it does not determine which results are found. If the Geocoding API does not recognize the language code, it may fall back to another language or the default language. Components other than the language code, such as the country and script codes, are ignored.
By default, this property is set to `null`, causing results to be in the default language.
This option is experimental.
language
- The locale in which results should be returned.public void cancelApiCall()
public int getCount()
getCount
in interface Adapter
public com.mapbox.services.api.geocoding.v5.models.CarmenFeature getItem(int position)
getItem
in interface Adapter
position
- int position within the data.CarmenFeature
.public long getItemId(int position)
getItemId
in interface Adapter
position
- int position within the data.public View getView(int position, View convertView, ViewGroup parent)
getView
in interface Adapter
position
- The position of the item within the adapter's data set of the item whose
view we want.convertView
- The old view to reuse, if possible.parent
- The parent that this view will eventually be attached to.public Filter getFilter()
getFilter
in interface Filterable
© 2015–2016 Mapbox. All rights reserved.