Register now for Android Dev Summit 2019!

Builder

open class Builder
kotlin.Any
   ↳ androidx.core.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

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

open Person.Builder
setIcon(@Nullable icon: IconCompat?)

Set an icon for this Person.

open Person.Builder
setImportant(important: Boolean)

Sets whether this is an important person.

open Person.Builder
setKey(@Nullable key: String?)

Set a unique identifier for this Person.

open Person.Builder
setName(@Nullable name: CharSequence?)

Give this Person a name to use for display.

open Person.Builder
setUri(@Nullable uri: String?)

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

Public constructors

<init>

Builder()

Creates a new, empty Builder.

Public methods

build

@NonNull open fun build(): Person

Creates and returns the Person this builder represents.

setBot

@NonNull open fun setBot(bot: Boolean): Person.Builder

Sets whether or not this Person represents a machine rather than a human. This is used primarily for testing and automated tooling.

setIcon

@NonNull open fun setIcon(@Nullable icon: IconCompat?): Person.Builder

Set an icon for this Person.

The system will prefer this icon over any images that are resolved from setUri(String).

setImportant

@NonNull open fun setImportant(important: 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(String) isn't provided with android.provider.ContactsContract.Contacts#CONTENT_LOOKUP_URI, and instead with the mailto: or tel: schemas.

setKey

@NonNull open fun setKey(@Nullable key: String?): Person.Builder

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.

setName

@NonNull open fun setName(@Nullable name: CharSequence?): Person.Builder

Give this Person a name to use for display. This can be, for example, a full name, nickname, username, etc.

setUri

@NonNull open fun setUri(@Nullable uri: String?): Person.Builder

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.