Person.Builder
public
static
class
Person.Builder
extends Object
java.lang.Object | |
↳ | androidx.core.app.Person.Builder |
Builder for the immutable Person
class.
Summary
Public constructors | |
---|---|
Builder()
Creates a new, empty |
Public methods | |
---|---|
Person
|
build()
Creates and returns the |
Person.Builder
|
setBot(boolean bot)
Sets whether or not this |
Person.Builder
|
setIcon(IconCompat icon)
Set an icon for this |
Person.Builder
|
setImportant(boolean important)
Sets whether this is an important person. |
Person.Builder
|
setKey(String key)
Set a unique identifier for this |
Person.Builder
|
setName(CharSequence name)
Give this |
Person.Builder
|
setUri(String uri)
Set a URI for this
*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. |
Inherited methods | |
---|---|
Public constructors
Public methods
setBot
public 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.
Parameters | |
---|---|
bot |
boolean |
Returns | |
---|---|
Person.Builder |
setIcon
public Person.Builder setIcon (IconCompat icon)
Set an icon for this Person
.
The system will prefer this icon over any images that are resolved from
setUri(String)
.
Parameters | |
---|---|
icon |
IconCompat |
Returns | |
---|---|
Person.Builder |
setImportant
public 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(String)
isn't provided with
ContactsContract.Contacts.CONTENT_LOOKUP_URI
, and instead with
the mailto:
or tel:
schemas.
Parameters | |
---|---|
important |
boolean |
Returns | |
---|---|
Person.Builder |
setKey
public Person.Builder setKey (String key)
Set a unique identifier for this Person
. This is especially useful if the
setName(CharSequence)
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.
Parameters | |
---|---|
key |
String |
Returns | |
---|---|
Person.Builder |
setName
public Person.Builder setName (CharSequence name)
Give this Person
a name to use for display. This can be, for example, a full
name, nickname, username, etc.
Parameters | |
---|---|
name |
CharSequence |
Returns | |
---|---|
Person.Builder |
setUri
public Person.Builder setUri (String uri)
Set a URI for this Person
which can be any of the following:
- The
String
representation of aContactsContract.Contacts.CONTENT_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.
Parameters | |
---|---|
uri |
String |
Returns | |
---|---|
Person.Builder |