當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。