Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/provider/ContactsContract.PinnedPositions#constants) \| [Ctors](https://developer.android.com/reference/android/provider/ContactsContract.PinnedPositions#pubctors) \| [Methods](https://developer.android.com/reference/android/provider/ContactsContract.PinnedPositions#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/provider/ContactsContract.PinnedPositions#inhmethods)

# ContactsContract.PinnedPositions

*** ** * ** ***


`
public
static
final

class
ContactsContract.PinnedPositions
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.provider.ContactsContract.PinnedPositions |

<br />

*** ** * ** ***

<br />


Contact-specific information about whether or not a contact has been pinned by the user
at a particular position within the system contact application's user interface.


This pinning information can be used by individual applications to customize how
they order particular pinned contacts. For example, a Dialer application could
use pinned information to order user-pinned contacts in a top row of favorites.


It is possible for two or more contacts to occupy the same pinned position (due
to aggregation and sync), so this pinning information should be used on a best-effort
basis to order contacts in-application rather than an absolute guide on where a contact
should be positioned. Contacts returned by the ContactsProvider will not be ordered based
on this information, so it is up to the client application to reorder these contacts within
their own UI adhering to (or ignoring as appropriate) information stored in the pinned
column.


By default, unpinned contacts will have a pinned position of
`https://developer.android.com/reference/android/provider/ContactsContract.PinnedPositions#UNPINNED`. Client-provided pinned positions can be positive
integers that are greater than 1.

<br />

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/provider/ContactsContract.PinnedPositions#DEMOTED` Value of pinned position for a contact that a user has indicated should be considered of the lowest priority. |
| `int` | `https://developer.android.com/reference/android/provider/ContactsContract.PinnedPositions#UNPINNED` Default value for the pinned position of an unpinned contact. |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/provider/ContactsContract.PinnedPositions#PinnedPositions()() ` |

| ### Public methods ||
|---|---|
| ` static void` | ` https://developer.android.com/reference/android/provider/ContactsContract.PinnedPositions#pin(android.content.ContentResolver,%20long,%20int)(https://developer.android.com/reference/android/content/ContentResolver contentResolver, long contactId, int pinnedPosition) ` Pins a contact at a provided position, or unpins a contact. |
| ` static void` | ` https://developer.android.com/reference/android/provider/ContactsContract.PinnedPositions#undemote(android.content.ContentResolver,%20long)(https://developer.android.com/reference/android/content/ContentResolver contentResolver, long contactId) ` Undemotes a formerly demoted contact. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` 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 https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` 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` | ` 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` | ` 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*. | ||

## Constants

### DEMOTED

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

```
public static final int DEMOTED
```

Value of pinned position for a contact that a user has indicated should be considered
of the lowest priority. It is up to the client application to determine how to present
such a contact - for example all the way at the bottom of a contact list, or simply
just hidden from view.

<br />

Constant Value:

-1
(0xffffffff)


### UNPINNED

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

```
public static final int UNPINNED
```

Default value for the pinned position of an unpinned contact.

<br />

Constant Value:

0
(0x00000000)


## Public constructors

### PinnedPositions

```
public PinnedPositions ()
```

<br />

<br />

## Public methods

### pin

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

```
public static void pin (ContentResolver contentResolver, 
                long contactId, 
                int pinnedPosition)
```

Pins a contact at a provided position, or unpins a contact.

<br />

| Parameters ||
|---|---|
| `contentResolver` | `ContentResolver`: to perform the pinning operation on. <br /> |
| `contactId` | `long` <br /> |
| `pinnedPosition` | `int`: the position to pin the contact at. To unpin a contact, use `https://developer.android.com/reference/android/provider/ContactsContract.PinnedPositions#UNPINNED`. <br /> |

### undemote

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

```
public static void undemote (ContentResolver contentResolver, 
                long contactId)
```

Undemotes a formerly demoted contact. If the contact was not previously demoted, nothing
will be done.

<br />

| Parameters ||
|---|---|
| `contentResolver` | `ContentResolver`: to perform the undemote operation on. <br /> |
| `contactId` | `long`: the id of the contact to undemote. <br /> |