# Person.Builder

Added in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Ctors](https://developer.android.com/reference/android/app/Person.Builder#pubctors)\|[Methods](https://developer.android.com/reference/android/app/Person.Builder#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/app/Person.Builder#inhmethods)  

# Person.Builder

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/app/Person.Builder "View this page in Kotlin")\|Java

`
public
static


class
Person.Builder
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|----------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.app.Person.Builder |

<br />

*** ** * ** ***

Builder for the immutable[Person](https://developer.android.com/reference/android/app/Person)class.

## Summary

|                                                                                        ### Public constructors                                                                                        ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[Builder](https://developer.android.com/reference/android/app/Person.Builder#Builder())`() ` Creates a new, empty[Builder](https://developer.android.com/reference/android/app/Person.Builder). |

|                                                                                                                                                            ### Public methods                                                                                                                                                             ||
|-----------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[Person](https://developer.android.com/reference/android/app/Person)                 | ` `[build](https://developer.android.com/reference/android/app/Person.Builder#build())`() ` Creates and returns the[Person](https://developer.android.com/reference/android/app/Person)this builder represents.                                  |
| ` `[Person.Builder](https://developer.android.com/reference/android/app/Person.Builder) | ` `[setBot](https://developer.android.com/reference/android/app/Person.Builder#setBot(boolean))`(boolean isBot) ` Sets whether this person is a machine rather than a human.                                                                     |
| ` `[Person.Builder](https://developer.android.com/reference/android/app/Person.Builder) | ` `[setIcon](https://developer.android.com/reference/android/app/Person.Builder#setIcon(android.graphics.drawable.Icon))`(`[Icon](https://developer.android.com/reference/android/graphics/drawable/Icon)` icon) ` Add an icon for this person.  |
| ` `[Person.Builder](https://developer.android.com/reference/android/app/Person.Builder) | ` `[setImportant](https://developer.android.com/reference/android/app/Person.Builder#setImportant(boolean))`(boolean isImportant) ` Sets whether this is an important person.                                                                    |
| ` `[Person.Builder](https://developer.android.com/reference/android/app/Person.Builder) | ` `[setKey](https://developer.android.com/reference/android/app/Person.Builder#setKey(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` key) ` Add a key to this person in order to uniquely identify it. |
| ` `[Person.Builder](https://developer.android.com/reference/android/app/Person.Builder) | ` `[setName](https://developer.android.com/reference/android/app/Person.Builder#setName(java.lang.CharSequence))`(`[CharSequence](https://developer.android.com/reference/java/lang/CharSequence)` name) ` Give this person a name.              |
| ` `[Person.Builder](https://developer.android.com/reference/android/app/Person.Builder) | ` `[setUri](https://developer.android.com/reference/android/app/Person.Builder#setUri(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` uri) ` Set a URI associated with this person.                     |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Public constructors

### Builder

Added in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Builder ()
```

Creates a new, empty[Builder](https://developer.android.com/reference/android/app/Person.Builder).

<br />

## Public methods

### build

Added in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Person build ()
```

Creates and returns the[Person](https://developer.android.com/reference/android/app/Person)this builder represents.

<br />

|                                                 Returns                                                  ||
|----------------------------------------------------------------------|------------------------------------|
| [Person](https://developer.android.com/reference/android/app/Person) | This value cannot be`null`. <br /> |

### setBot

Added in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Person.Builder setBot (boolean isBot)
```

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

<br />

|                                  Parameters                                   ||
|---------|----------------------------------------------------------------------|
| `isBot` | `boolean`:`true`if this person is a machine,`false`otherwise. <br /> |

|                                                         Returns                                                          ||
|--------------------------------------------------------------------------------------|------------------------------------|
| [Person.Builder](https://developer.android.com/reference/android/app/Person.Builder) | This value cannot be`null`. <br /> |

### setIcon

Added in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Person.Builder setIcon (Icon icon)
```

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

<br />

|                               Parameters                                ||
|--------|-----------------------------------------------------------------|
| `icon` | `Icon`: the icon of the person. This value may be`null`. <br /> |

|                                                         Returns                                                          ||
|--------------------------------------------------------------------------------------|------------------------------------|
| [Person.Builder](https://developer.android.com/reference/android/app/Person.Builder) | This value cannot be`null`. <br /> |

### setImportant

Added in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Person.Builder setImportant (boolean isImportant)
```

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)](https://developer.android.com/reference/android/app/Person.Builder#setUri(java.lang.String))isn't provided with[ContactsContract.Contacts.CONTENT_LOOKUP_URI](https://developer.android.com/reference/android/provider/ContactsContract.Contacts#CONTENT_LOOKUP_URI), and instead with the`mailto:`or`tel:`schemas.

<br />

|                                       Parameters                                       ||
|---------------|-------------------------------------------------------------------------|
| `isImportant` | `boolean`:`true`if this is an important person,`false`otherwise. <br /> |

|                                                         Returns                                                          ||
|--------------------------------------------------------------------------------------|------------------------------------|
| [Person.Builder](https://developer.android.com/reference/android/app/Person.Builder) | This value cannot be`null`. <br /> |

### setKey

Added in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Person.Builder setKey (String key)
```

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.

<br />

<br />

|                                           Parameters                                           ||
|-------|-----------------------------------------------------------------------------------------|
| `key` | `String`: the key that uniquely identifies this person. This value may be`null`. <br /> |

|                                                         Returns                                                          ||
|--------------------------------------------------------------------------------------|------------------------------------|
| [Person.Builder](https://developer.android.com/reference/android/app/Person.Builder) | This value cannot be`null`. <br /> |

### setName

Added in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Person.Builder setName (CharSequence name)
```

Give this person a name.

<br />

|                                    Parameters                                    ||
|--------|--------------------------------------------------------------------------|
| `name` | `CharSequence`: the name of this person. This value may be`null`. <br /> |

|                                                         Returns                                                          ||
|--------------------------------------------------------------------------------------|------------------------------------|
| [Person.Builder](https://developer.android.com/reference/android/app/Person.Builder) | This value cannot be`null`. <br /> |

### setUri

Added in[API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Person.Builder setUri (String uri)
```

Set a URI associated with this person.

The person should be specified by the`String`representation of a[ContactsContract.Contacts.CONTENT_LOOKUP_URI](https://developer.android.com/reference/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[ContactsContract.PhoneLookup](https://developer.android.com/reference/android/provider/ContactsContract.PhoneLookup).

<br />

<br />

|                               Parameters                               ||
|-------|-----------------------------------------------------------------|
| `uri` | `String`: a URI for the person. This value may be`null`. <br /> |

|                                                         Returns                                                          ||
|--------------------------------------------------------------------------------------|------------------------------------|
| [Person.Builder](https://developer.android.com/reference/android/app/Person.Builder) | This value cannot be`null`. <br /> |