0

我在 android 设备上有一些帐户存储在 contacts2.db 的帐户表中;我如何按 asc 对它们进行排序?

我没有找到从 ContactsContract 访问帐户表的权限。

谢谢。

4

1 回答 1

0

To get list of accounts you have to use AccountManager, not Contacts' content provider. Do this.

Account[] accounts = AccountManager.get(context).getAccounts();
for (Account account : accounts) {
   ...
}

And sort it as you want. Also note app have to request GET_ACCOUNTS permission to do that:

<uses-permission android:name="android.permission.GET_ACCOUNTS" />
于 2012-09-04T14:07:29.807 回答