public class

Contact

extends Object
java.lang.Object
   ↳ com.neomades.contact.Contact

Class Overview

This class represents a contact: it stores information like name, phone number, email address, postal address...
You must use ContactManager class to create, edit or show contacts of the device.

Cross Platform Considerations

  • On Android, the fields of the Contact object are represented in android.provider.ContactsContract.CommonDataKinds.
  • On iOS, the Contact object is represented by ABPerson.

Summary

Public Constructors
Contact()
Public Methods
String getCity()
Returns the contact's city.
String getCountry()
Returns the contact's country.
String getDisplayName()
Returns the name that should be used to display the contact.
String getEmailAddress()
Returns the contact's default email address for type HOME.
String getEmailAddress(int type)
Returns the contact's email address for the chosen type EmailKind.
String getFirstName()
Returns the contact's first name.
String getFullPostalAddress()
Returns the contact's default full postal address for type HOME.
String getFullPostalAddress(int type)
Returns the contact's full postal address for the chosen type {@link AddressKind).
int getId()
Returns the identifier of this contact, by default all contacts return "0".
String getLastName()
Returns the contact's last name.
String getMiddleName()
Returns the contact's middle name.
String getNamePrefix()
Returns the contact's name prefix.
String getNameSuffix()
Returns the contact's name suffix.
String getNickname()
Returns the contact's nickname.
String getPhoneNumber()
Returns the contact's default phone number for type MOBILE.
String getPhoneNumber(int type)
Returns the contact's phone number for the chosen type (PhoneKind).
String getPostalCode()
Returns the contact's postal code.
String getState()
Returns the contact's state.
String getStreet()
Returns the contact's street.
void setCity(String city)
Sets the contact's city.
void setCountry(String country)
Sets the contact's country name or code.
void setDisplayName(String displayName)
Sets the contact's display name.
void setEmailAddress(String emailAddress, int type)
Sets the contact's email address and its type EmailKind.
void setEmailAddress(String emailAddress)
Sets the contact's email address for type HOME.
void setFirstName(String firstName)
Sets the contact's first name.
void setFullPostalAddress(String fullPostalAddress)
Sets the contact's postal address for type HOME.
void setFullPostalAddress(String fullPostalAddress, int type)
Sets the contact's postal address, and its type (HOME, WORK or OTHER).
void setId(int id)
Sets a identifier/tag to this contact
void setLastName(String lastName)
Sets the contact's last name.
void setMiddleName(String middleName)
Sets the contact's middle name.
void setNamePrefix(String namePrefix)
Sets the contact's honorific prefix, as "Sir","Mr" or "Mrs".
void setNameSuffix(String nameSuffix)
Sets the contact's honorific suffix, as "Jr".
void setNickname(String nickname)
Sets the contact's nickname.
void setPhoneNumber(String phoneNumber, int type)
Sets the contact's phone number, and its type PhoneKind.
void setPhoneNumber(String phoneNumber)
Sets the contact's phone number for type MOBILE.
void setPostalCode(String postalCode)
Sets the contact's postal code.
void setState(String state)
Sets the contact's state.
void setStreet(String street)
Sets the contact's street.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Contact ()

Public Methods

public String getCity ()

Returns the contact's city.

Returns
  • a city (or an empty String, if it doesn't exist)

public String getCountry ()

Returns the contact's country.

Returns
  • a country (or an empty String, if it doesn't exist)

public String getDisplayName ()

Returns the name that should be used to display the contact.

Returns
  • a full name (or an empty String, if it doesn't exist)

public String getEmailAddress ()

Returns the contact's default email address for type HOME.

Returns
  • an email address (or an empty String, if it doesn't exist)

public String getEmailAddress (int type)

Returns the contact's email address for the chosen type EmailKind.

Parameters
type the email address type to return
Returns
  • an email address (or an empty String, if it doesn't exist)

public String getFirstName ()

Returns the contact's first name.

Returns
  • a first name (or an empty String, if doesn't exist)

public String getFullPostalAddress ()

Returns the contact's default full postal address for type HOME.

Returns
  • a full postal address (or an empty String, if it doesn't exist)

public String getFullPostalAddress (int type)

Returns the contact's full postal address for the chosen type {@link AddressKind).

Parameters
type the postal address type to return
Returns
  • a full postal address (or an empty String, if it doesn't exist)

public int getId ()

Returns the identifier of this contact, by default all contacts return "0".

Returns
  • the identifier of this contact or "0" if none
See Also

public String getLastName ()

Returns the contact's last name.

Returns
  • a last name (or an empty String, if it doesn't exist)

public String getMiddleName ()

Returns the contact's middle name.

Returns
  • a middle name (or an empty String, if it doesn't exist)

public String getNamePrefix ()

Returns the contact's name prefix.

Returns
  • a name prefix (or an empty String, if it doesn't exist)

public String getNameSuffix ()

Returns the contact's name suffix.

Returns
  • a name suffix (or an empty String, if it doesn't exist)

public String getNickname ()

Returns the contact's nickname.

Returns
  • a nickname (or an empty String, if it doesn't exist)

public String getPhoneNumber ()

Returns the contact's default phone number for type MOBILE.

Returns
  • a phone number (or an empty String, if it doesn't exist)

public String getPhoneNumber (int type)

Returns the contact's phone number for the chosen type (PhoneKind).

Parameters
type the phone number type to return
Returns
  • a phone number (or an empty String, if it doesn't exist)

public String getPostalCode ()

Returns the contact's postal code.

Returns
  • a postal code (or an empty String, if it doesn't exist)

public String getState ()

Returns the contact's state.

Returns
  • a state (or an empty String, if it doesn't exist)

public String getStreet ()

Returns the contact's street.

Returns
  • a street (or an empty String, if doesn't exist)

public void setCity (String city)

Sets the contact's city. It can be city, village, town, borough, etc.

Parameters
city city of the contact (if null, empty String is set)

public void setCountry (String country)

Sets the contact's country name or code.

Parameters
country country of the contact (if null, empty String is set)

public void setDisplayName (String displayName)

Sets the contact's display name.

Parameters
displayName full name of the contact (if null, empty String is set)
See Also

public void setEmailAddress (String emailAddress, int type)

Sets the contact's email address and its type EmailKind.

Parameters
emailAddress email address of the contact (if null, empty String is set)
type the email address type
Throws
IllegalArgumentException if the type doesn't exist

public void setEmailAddress (String emailAddress)

Sets the contact's email address for type HOME.

Parameters
emailAddress email address of the contact (if null, empty String is set)
Throws
IllegalArgumentException if the type doesn't exist

public void setFirstName (String firstName)

Sets the contact's first name.

Parameters
firstName first name of the contact (if null, empty String is set)
See Also

public void setFullPostalAddress (String fullPostalAddress)

Sets the contact's postal address for type HOME.

Parameters
fullPostalAddress full postal address of the contact (if null, empty String is set)
Throws
IllegalArgumentException if the type doesn't exist

public void setFullPostalAddress (String fullPostalAddress, int type)

Sets the contact's postal address, and its type (HOME, WORK or OTHER).

Parameters
fullPostalAddress full postal address of the contact (if null, empty String is set)
type the address type
Throws
IllegalArgumentException if the type doesn't exist

public void setId (int id)

Sets a identifier/tag to this contact

Parameters
id the identifier
See Also

public void setLastName (String lastName)

Sets the contact's last name.

Parameters
lastName last name of the contact (if null, empty String is set)
See Also

public void setMiddleName (String middleName)

Sets the contact's middle name.

Parameters
middleName middle name of the contact (if null, empty String is set)
See Also

public void setNamePrefix (String namePrefix)

Sets the contact's honorific prefix, as "Sir","Mr" or "Mrs".

Parameters
namePrefix name prefix of the contact (if null, empty String is set)
See Also

public void setNameSuffix (String nameSuffix)

Sets the contact's honorific suffix, as "Jr".

Parameters
nameSuffix name suffix of the contact (if null, empty String is set)
See Also

public void setNickname (String nickname)

Sets the contact's nickname.

Parameters
nickname nickname of the contact (if null, empty String is set)
See Also

public void setPhoneNumber (String phoneNumber, int type)

Sets the contact's phone number, and its type PhoneKind.

Parameters
phoneNumber phone number of the contact (if null, empty String is set)
type the phone number type
Throws
IllegalArgumentException if the type doesn't exist

public void setPhoneNumber (String phoneNumber)

Sets the contact's phone number for type MOBILE.

Parameters
phoneNumber phone number of the contact (if null, empty String is set)
Throws
IllegalArgumentException if the type doesn't exist

public void setPostalCode (String postalCode)

Sets the contact's postal code. Usually country-wide, but sometimes specific to the city.

Parameters
postalCode postal code of the contact (if null, empty String is set)

public void setState (String state)

Sets the contact's state. It can be a state, province, county (in Ireland), Land (in Germany), department (in France), etc.

Parameters
state state/region of the contact (if null, empty String is set)

public void setStreet (String street)

Sets the contact's street. It can be street, avenue, road, etc.
This element also includes the house number and room/apartment/flat/floor number.

Parameters
street street of the contact (if null, empty String is set)