本文整理汇总了Java中android.provider.ContactsContract.Settings类的典型用法代码示例。如果您正苦于以下问题:Java Settings类的具体用法?Java Settings怎么用?Java Settings使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Settings类属于android.provider.ContactsContract包,在下文中一共展示了Settings类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AddressbookManagerAndroid
import android.provider.ContactsContract.Settings; //导入依赖的package包/类
public AddressbookManagerAndroid(Context context,
ContentResolver contentResolver) {
this.cr = contentResolver;
// this.context = context;
am = AccountManager.get(context);
panboxAccount = new Account(accountName, accountType);
am.addAccountExplicitly(panboxAccount, null, null);
ContentProviderClient client = contentResolver
.acquireContentProviderClient(ContactsContract.AUTHORITY_URI);
ContentValues values = new ContentValues();
values.put(ContactsContract.Groups.ACCOUNT_NAME, accountName);
values.put(Groups.ACCOUNT_TYPE, accountType);
values.put(Settings.UNGROUPED_VISIBLE, true);
values.put(Settings.SHOULD_SYNC, false);
try {
client.insert(
Settings.CONTENT_URI
.buildUpon()
.appendQueryParameter(
ContactsContract.CALLER_IS_SYNCADAPTER,
"true").build(), values);
} catch (RemoteException e) {
e.printStackTrace();
}
}
示例2: setAccountContactsVisibility
import android.provider.ContactsContract.Settings; //导入依赖的package包/类
/**
* When we first add a sync adapter to the system, the contacts from that
* sync adapter will be hidden unless they're merged/grouped with an existing
* contact. But typically we want to actually show those contacts, so we
* need to mess with the Settings table to get them to show up.
*
* @param context the Authenticator Activity context
* @param account the Account who's visibility we're changing
* @param visible true if we want the contacts visible, false for hidden
*/
public static void setAccountContactsVisibility(Context context, Account account,
boolean visible) {
ContentValues values = new ContentValues();
values.put(RawContacts.ACCOUNT_NAME, account.name);
values.put(RawContacts.ACCOUNT_TYPE, Constants.ACCOUNT_TYPE);
values.put(Settings.UNGROUPED_VISIBLE, visible ? 1 : 0);
context.getContentResolver().insert(Settings.CONTENT_URI, values);
}
示例3: setAccountContactsVisibility
import android.provider.ContactsContract.Settings; //导入依赖的package包/类
/**
* When we first add a sync adapter to the system, the contacts from that
* sync adapter will be hidden unless they're merged/grouped with an
* existing contact. But typically we want to actually show those contacts,
* so we need to mess with the Settings table to get them to show up.
*
* @param context
* the Authenticator Activity context
* @param account
* the Account who's visibility we're changing
* @param visible
* true if we want the contacts visible, false for hidden
*/
public static void setAccountContactsVisibility(Context context,
Account account, boolean visible) {
ContentValues values = new ContentValues();
values.put(RawContacts.ACCOUNT_NAME, account.name);
values.put(RawContacts.ACCOUNT_TYPE, Constants.ACCOUNT_TYPE);
values.put(Settings.UNGROUPED_VISIBLE, visible ? 1 : 0);
context.getContentResolver().insert(Settings.CONTENT_URI, values);
}