当前位置: 首页>>代码示例>>Java>>正文


Java Settings类代码示例

本文整理汇总了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();
	}

}
 
开发者ID:Rohde-Schwarz-Cybersecurity,项目名称:PanBox,代码行数:30,代码来源:AddressbookManagerAndroid.java

示例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);
}
 
开发者ID:xwiki-contrib,项目名称:android-authenticator,代码行数:20,代码来源:ContactManager.java

示例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);
}
 
开发者ID:mgrieder,项目名称:ntsync-android,代码行数:23,代码来源:ContactManager.java


注:本文中的android.provider.ContactsContract.Settings类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。