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

Person.Builder()

Creates a new, empty Person.Builder.

Public methods

Person build()

Creates and returns the Person this builder represents.

Person.Builder setBot(boolean bot)

Sets whether or not this Person represents a machine rather than a human.

Person.Builder setIcon(IconCompat icon)

Set an icon for this Person.

Person.Builder setImportant(boolean important)

Sets whether this is an important person.

Person.Builder setKey(String key)

Set a unique identifier for this Person.

Person.Builder setName(CharSequence name)

Give this Person a name to use for display.

Person.Builder setUri(String uri)

Set a URI for this Person which can be any of the following:

*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

Person.Builder

public Person.Builder ()

Creates a new, empty Person.Builder.

Public methods

build

public Person build ()

Creates and returns the Person this builder represents.

Returns
Person

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:

*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