# ContactsContract.RawContacts.DefaultAccount

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

# DefaultAccount

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/provider/ContactsContract.RawContacts.DefaultAccount "View this page in Java")  

```
class DefaultAccount
```

|---|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                                               ||
| ↳ | [android.provider.ContactsContract.RawContacts.DefaultAccount](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount#) |

Class containing utility methods around the default account. New raw contacts requested to be inserted without a specified[Account](https://developer.android.com/reference/kotlin/android/accounts/Account.html#)will be saved in the default account.

## Summary

|                                                                                                                                                               Nested classes                                                                                                                                                                ||
|---|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|   | [DefaultAccountAndState](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState) Represents the state of the default account, and the actual[Account](https://developer.android.com/reference/kotlin/android/accounts/Account.html#)if it's a cloud account. |

|                                                                                                                                                                                 Constants                                                                                                                                                                                  ||
|----------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [ACTION_MOVE_CONTACTS_TO_DEFAULT_ACCOUNT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount#ACTION_MOVE_CONTACTS_TO_DEFAULT_ACCOUNT:kotlin.String) Action used to launch the UI to move contacts to the default account. |

|                                                                                                                                                                                                                                                                                                                                                      Public methods                                                                                                                                                                                                                                                                                                                                                      ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| static[ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState) | [getDefaultAccountForNewContacts](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount#getDefaultAccountForNewContacts(android.content.ContentResolver))`(`resolver:` `[ContentResolver](https://developer.android.com/reference/kotlin/android/content/ContentResolver.html#)`)` Get the account that is set as the default account for new contacts, which should be initially selected when creating a new contact on contact management apps. |

## Constants

### ACTION_MOVE_CONTACTS_TO_DEFAULT_ACCOUNT

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

```
static val ACTION_MOVE_CONTACTS_TO_DEFAULT_ACCOUNT: String
```

Action used to launch the UI to move contacts to the default account.  

    Value: "android.provider.action.MOVE_CONTACTS_TO_DEFAULT_ACCOUNT"

## Public methods

### getDefaultAccountForNewContacts

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

```
static fun getDefaultAccountForNewContacts(resolver: ContentResolver): ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState
```

Get the account that is set as the default account for new contacts, which should be initially selected when creating a new contact on contact management apps.

|                                                                                  Parameters                                                                                   ||
|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `resolver` | [ContentResolver](https://developer.android.com/reference/kotlin/android/content/ContentResolver.html#):the ContentResolver to query. This value cannot be`null`. |

|                                                                                                                                      Return                                                                                                                                       ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
| [ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState) | the default account state for new contacts. This value cannot be`null`. |

|                                    Exceptions                                     ||
|-----------------------------------|------------------------------------------------|
| `java.lang.RuntimeException`      | if failed to look up the default account.      |
| `java.lang.IllegalStateException` | if the default account is in an invalid state. |