Added in API level 28

Builder


class Builder
kotlin.Any
   ↳ android.app.Person.Builder

Builder for the immutable Person class.

Summary

Public constructors

Creates a new, empty Builder.

Public methods
open Person

Creates and returns the Person this builder represents.

open Person.Builder
setBot(isBot: Boolean)

Sets whether this person is a machine rather than a human.

open Person.Builder
setIcon(icon: Icon?)

Add an icon for this person.

open Person.Builder
setImportant(isImportant: Boolean)

Sets whether this is an important person.

open Person.Builder
setKey(key: String?)

Add a key to this person in order to uniquely identify it.

open Person.Builder

Give this person a name.

open Person.Builder
setUri(uri: String?)

Set a URI associated with this person.

Public constructors

Builder

Added in API level 28
Builder()

Creates a new, empty Builder.

Public methods

build

Added in API level 28
open fun build(): Person

Creates and returns the Person this builder represents.

Return
Person This value cannot be null.

setBot

Added in API level 28
open fun setBot(isBot: Boolean): Person.Builder

Sets whether this person is a machine rather than a human.

Parameters
isBot Boolean: true if this person is a machine, false otherwise.
Return
Person.Builder This value cannot be null.

setIcon

Added in API level 28
open fun setIcon(icon: Icon?): Person.Builder

Add an icon for this person.
The system will prefer this icon over any images that are resolved from the URI.

Parameters
icon Icon?: the icon of the person. This value may be null.
Return
Person.Builder This value cannot be null.

setImportant

Added in API level 28
open fun setImportant(isImportant: Boolean): Person.Builder

Sets whether this is an important person. Use this method to denote users who frequently interact with the user of this device when setUri(java.lang.String) isn't provided with android.provider.ContactsContract.Contacts#CONTENT_LOOKUP_URI, and instead with the mailto: or tel: schemas.

Parameters
isImportant Boolean: true if this is an important person, false otherwise.
Return
Person.Builder This value cannot be null.

setKey

Added in API level 28
open fun setKey(key: String?): Person.Builder

Add a key to this person in order to uniquely identify it. This is especially useful if the name doesn't uniquely identify this person or if the display name is a short handle of the actual name.

If no key is provided, the name serves as the key for the purpose of identification.

Parameters
key String?: the key that uniquely identifies this person. This value may be null.
Return
Person.Builder This value cannot be null.

setName

Added in API level 28
open fun setName(name: CharSequence?): Person.Builder

Give this person a name.

Parameters
name CharSequence?: the name of this person. This value may be null.
Return
Person.Builder This value cannot be null.

setUri

Added in API level 28
open fun setUri(uri: String?): Person.Builder

Set a URI associated with this person.

The person should be specified by the String representation of a android.provider.ContactsContract.Contacts#CONTENT_LOOKUP_URI.

The system will also attempt to resolve mailto: and tel: schema URIs. The path part of these URIs must exist in the contacts database, in the appropriate column, or the reference will be discarded as invalid. Telephone schema URIs will be resolved by android.provider.ContactsContract.PhoneLookup.

Parameters
uri String?: a URI for the person. This value may be null.
Return
Person.Builder This value cannot be null.