public class Address extends Object implements Parcelable
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static Parcelable.Creator<Address> |
CREATOR |
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_ELIDE_DUPLICATES, PARCELABLE_WRITE_RETURN_VALUE
Constructor and Description |
---|
Address(Locale locale)
Constructs a new Address object set to the given Locale and with all
other fields initialized to null or false.
|
Modifier and Type | Method and Description |
---|---|
void |
clearLatitude()
Removes any latitude associated with this address.
|
void |
clearLongitude()
Removes any longitude associated with this address.
|
int |
describeContents()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation.
|
String |
getAddressLine(int index)
Returns a line of the address numbered by the given index
(starting at 0), or null if no such line is present.
|
String |
getAdminArea()
Returns the administrative area name of the address, for example, "CA", or null if
it is unknown
|
String |
getCountryCode()
Returns the country code of the address, for example "US",
or null if it is unknown.
|
String |
getCountryName()
Returns the localized country name of the address, for example "Iceland",
or null if it is unknown.
|
Bundle |
getExtras()
Returns additional provider-specific information about the
address as a Bundle.
|
String |
getFeatureName()
Returns the feature name of the address, for example, "Golden Gate Bridge", or null
if it is unknown
|
double |
getLatitude()
Returns the latitude of the address if known.
|
Locale |
getLocale()
Returns the Locale associated with this address.
|
String |
getLocality()
Returns the locality of the address, for example "Mountain View", or null if it is unknown.
|
double |
getLongitude()
Returns the longitude of the address if known.
|
int |
getMaxAddressLineIndex()
Returns the largest index currently in use to specify an address line.
|
String |
getPhone()
Returns the phone number of the address if known,
or null if it is unknown.
|
String |
getPostalCode()
Returns the postal code of the address, for example "94110",
or null if it is unknown.
|
String |
getPremises()
Returns the premises of the address, or null if it is unknown.
|
String |
getSubAdminArea()
Returns the sub-administrative area name of the address, for example, "Santa Clara County",
or null if it is unknown
|
String |
getSubLocality()
Returns the sub-locality of the address, or null if it is unknown.
|
String |
getSubThoroughfare()
Returns the sub-thoroughfare name of the address, which may be null.
|
String |
getThoroughfare()
Returns the thoroughfare name of the address, for example, "1600 Ampitheater Parkway",
which may be null
|
String |
getUrl()
Returns the public URL for the address if known,
or null if it is unknown.
|
boolean |
hasLatitude()
Returns true if a latitude has been assigned to this Address,
false otherwise.
|
boolean |
hasLongitude()
Returns true if a longitude has been assigned to this Address,
false otherwise.
|
void |
setAddressLine(int index,
String line)
Sets the line of the address numbered by index (starting at 0) to the
given String, which may be null.
|
void |
setAdminArea(String adminArea)
Sets the administrative area name of the address to the given String, which may be null
|
void |
setCountryCode(String countryCode)
Sets the country code of the address to the given String, which may
be null.
|
void |
setCountryName(String countryName)
Sets the country name of the address to the given String, which may
be null.
|
void |
setExtras(Bundle extras)
Sets the extra information associated with this fix to the
given Bundle.
|
void |
setFeatureName(String featureName)
Sets the feature name of the address to the given String, which may be null
|
void |
setLatitude(double latitude)
Sets the latitude associated with this address.
|
void |
setLocality(String locality)
Sets the locality of the address to the given String, which may be null.
|
void |
setLongitude(double longitude)
Sets the longitude associated with this address.
|
void |
setPhone(String phone)
Sets the phone number associated with this address.
|
void |
setPostalCode(String postalCode)
Sets the postal code of the address to the given String, which may
be null.
|
void |
setPremises(String premises)
Sets the premises of the address to the given String, which may be null.
|
void |
setSubAdminArea(String subAdminArea)
Sets the sub-administrative area name of the address to the given String, which may be null
|
void |
setSubLocality(String sublocality)
Sets the sub-locality of the address to the given String, which may be null.
|
void |
setSubThoroughfare(String subthoroughfare)
Sets the sub-thoroughfare name of the address, which may be null.
|
void |
setThoroughfare(String thoroughfare)
Sets the thoroughfare name of the address, which may be null.
|
void |
setUrl(String Url)
Sets the public URL associated with this address.
|
String |
toString()
Returns a string representation of the object.
|
void |
writeToParcel(Parcel parcel,
int flags)
Flatten this object in to a Parcel.
|
public static final Parcelable.Creator<Address> CREATOR
public Address(Locale locale)
public Locale getLocale()
public int getMaxAddressLineIndex()
public String getAddressLine(int index)
IllegalArgumentException
- if index < 0public void setAddressLine(int index, String line)
IllegalArgumentException
- if index < 0public String getFeatureName()
public void setFeatureName(String featureName)
public String getAdminArea()
public void setAdminArea(String adminArea)
public String getSubAdminArea()
public void setSubAdminArea(String subAdminArea)
public String getLocality()
public void setLocality(String locality)
public String getSubLocality()
public void setSubLocality(String sublocality)
public String getThoroughfare()
public void setThoroughfare(String thoroughfare)
public String getSubThoroughfare()
public void setSubThoroughfare(String subthoroughfare)
public String getPremises()
public void setPremises(String premises)
public String getPostalCode()
public void setPostalCode(String postalCode)
public String getCountryCode()
public void setCountryCode(String countryCode)
public String getCountryName()
public void setCountryName(String countryName)
public boolean hasLatitude()
public double getLatitude()
IllegalStateException
- if this Address has not been assigned
a latitude.public void setLatitude(double latitude)
public void clearLatitude()
public boolean hasLongitude()
public double getLongitude()
IllegalStateException
- if this Address has not been assigned
a longitude.public void setLongitude(double longitude)
public void clearLongitude()
public String getPhone()
IllegalStateException
- if this Address has not been assigned
a latitude.public void setPhone(String phone)
public String getUrl()
public void setUrl(String Url)
public Bundle getExtras()
public void setExtras(Bundle extras)
public String toString()
Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
public int describeContents()
Parcelable
Parcelable.writeToParcel(Parcel, int)
,
the return value of this method must include the
Parcelable.CONTENTS_FILE_DESCRIPTOR
bit.describeContents
in interface Parcelable
Parcelable.CONTENTS_FILE_DESCRIPTOR
public void writeToParcel(Parcel parcel, int flags)
Parcelable
writeToParcel
in interface Parcelable
parcel
- The Parcel in which the object should be written.flags
- Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE
.