List of usage examples for android.content SyncAdapterType supportsUploading
boolean supportsUploading
To view the source code for android.content SyncAdapterType supportsUploading.
Click Source Link
From source file:edu.cmu.cylab.starslinger.view.SaveActivity.java
@Override public void onAccountsUpdated(Account[] a) { MyLog.i(TAG, "Account list update detected"); // Clear out any old data to prevent duplicates mAccounts.clear();/* w ww . j a v a 2 s. com*/ // Get account data from system AuthenticatorDescription[] accountTypes = AccountManager.get(this).getAuthenticatorTypes(); // Also, get a list of all sync adapters and find the ones that // support contacts: SyncAdapterType[] syncs = ContentResolver.getSyncAdapterTypes(); ArrayList<String> contactAccountTypes = new ArrayList<String>(); for (SyncAdapterType sync : syncs) { if (ContactsContract.AUTHORITY.equals(sync.authority) && sync.supportsUploading()) { contactAccountTypes.add(sync.accountType); } } // Populate tables for (int i = 0; i < a.length; i++) { // The user may have multiple accounts with the same name, so we // need to construct a // meaningful display name for each. String systemAccountType = a[i].type; AuthenticatorDescription ad = getAuthenticatorDescription(systemAccountType, accountTypes); if (ad != null) { AccountData data = new AccountData(this, a[i].name, ad); // filter on accounts that support contacts if (contactAccountTypes.contains(a[i].type)) mAccounts.add(data); } } // unsync account AuthenticatorDescription adNull = new AuthenticatorDescription(mUnsyncType, UNSYNC_PKG, 0, 0, 0, 0); AccountData aNull = new AccountData(this, mUnsyncName, adNull); mAccounts.add(aNull); // Update the account spinner mAccountAdapter.notifyDataSetChanged(); }