Person.Builder
public class Person.Builder
Builder for the immutable Person class.
Summary
Public methods |
|
|---|---|
@NonNull Person |
build()Creates and returns the |
@NonNull Person.Builder |
setBot(boolean bot)Sets whether or not this |
@NonNull Person.Builder |
setIcon(@Nullable IconCompat icon)Set an icon for this |
@NonNull Person.Builder |
setImportant(boolean important)Sets whether this is an important person. |
@NonNull Person.Builder |
Set a unique identifier for this |
@NonNull Person.Builder |
setName(@Nullable CharSequence name)Give this |
@NonNull Person.Builder |
Set a URI for this |
Public methods
build
public @NonNull Person build()
Creates and returns the Person this builder represents.
setBot
public @NonNull Person.Builder setBot(boolean bot)
Sets whether or not this Person represents a machine rather than a human. This is used primarily for testing and automated tooling.
setIcon
public @NonNull Person.Builder setIcon(@Nullable IconCompat icon)
Set an icon for this Person.
The system will prefer this icon over any images that are resolved from setUri.
setImportant
public @NonNull Person.Builder setImportant(boolean important)
Sets whether this is an important person. Use this method to denote users who frequently interact with the user of this device when setUri isn't provided with CONTENT_LOOKUP_URI, and instead with the mailto: or tel: schemas.
setKey
public @NonNull Person.Builder setKey(@Nullable String key)
Set a unique identifier for this Person. This is especially useful if the setName value isn't unique. This value is preferred for identification, but if it's not provided, the person's name will be used in its place.
setName
public @NonNull Person.Builder setName(@Nullable CharSequence name)
Give this Person a name to use for display. This can be, for example, a full name, nickname, username, etc.
setUri
public @NonNull Person.Builder setUri(@Nullable String uri)
Set a URI for this Person which can be any of the following:
- The
Stringrepresentation of aCONTENT_LOOKUP_URI - A
mailto:schema* - A
tel:schema*
*Note for these schemas, the path portion of the URI must exist in the contacts database in their appropriate column, otherwise the reference will be discarded.