Stay organized with collections
Save and categorize content based on your preferences.
DefaultAccount
class DefaultAccount
Class containing utility methods around the default account. New raw contacts requested to be inserted without a specified Account
will be saved in the default account.
Summary
Nested classes |
|
Represents the state of the default account, and the actual Account if it's a cloud account.
|
Constants |
static String |
Action used to launch the UI to move contacts to the default account.
|
Constants
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
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: the ContentResolver to query. 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. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-03-13 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-13 UTC."],[],[],null,["# ContactsContract.RawContacts.DefaultAccount\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nDefaultAccount\n==============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/provider/ContactsContract.RawContacts.DefaultAccount \"View this page in Java\") \n\n```\nclass DefaultAccount\n```\n\n|---|-------------------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.provider.ContactsContract.RawContacts.DefaultAccount](#) |\n\nClass containing utility methods around the default account. New raw contacts requested to be inserted without a specified [Account](../accounts/Account.html#) will be saved in the default account.\n\nSummary\n-------\n\n| Nested classes ||\n|---|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [DefaultAccountAndState](/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState) Represents the state of the default account, and the actual [Account](../accounts/Account.html#) if it's a cloud account. |\n\n| Constants ||\n|-----------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [ACTION_MOVE_CONTACTS_TO_DEFAULT_ACCOUNT](#ACTION_MOVE_CONTACTS_TO_DEFAULT_ACCOUNT:kotlin.String) Action used to launch the UI to move contacts to the default account. |\n\n| Public methods ||\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static [ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState](/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState) | [getDefaultAccountForNewContacts](#getDefaultAccountForNewContacts(android.content.ContentResolver))`(`resolver:` `[ContentResolver](../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. |\n\nConstants\n---------\n\n### ACTION_MOVE_CONTACTS_TO_DEFAULT_ACCOUNT\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val ACTION_MOVE_CONTACTS_TO_DEFAULT_ACCOUNT: String\n```\n\nAction used to launch the UI to move contacts to the default account. \n\n Value: \"android.provider.action.MOVE_CONTACTS_TO_DEFAULT_ACCOUNT\"\n\nPublic methods\n--------------\n\n### getDefaultAccountForNewContacts\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic fun getDefaultAccountForNewContacts(resolver: ContentResolver): ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState\n```\n\nGet 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.\n\n| Parameters ||\n|------------|-----------------------------------------------------------------------------------------------------------------|\n| `resolver` | [ContentResolver](../content/ContentResolver.html#): the ContentResolver to query. This value cannot be `null`. |\n\n| Return ||\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|\n| [ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState](/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState) | the default account state for new contacts. This value cannot be `null`. |\n\n| Exceptions ||\n|-----------------------------------|------------------------------------------------|\n| `java.lang.RuntimeException` | if failed to look up the default account. |\n| `java.lang.IllegalStateException` | if the default account is in an invalid state. |"]]