Code example for ListPreference

Methods: findIndexOfValue, getEntries, setSummary

0
     */ 
    private void setSyncFrequency(Account account) {
      if (account != null) {
        String syncValue = mPreferences.getString("sync_frequency_preference", "900");
 
        mSyncPreference.setSummary("Sync every "
            + mSyncPreference.getEntries()[mSyncPreference.findIndexOfValue(syncValue)]);
 
        ContentResolver.setSyncAutomatically(account, "com.google.provider.NotePad", true);
        ContentResolver.addPeriodicSync(account, "com.google.provider.NotePad", new Bundle(),
            Long.parseLong(syncValue));
      } 
    } 
 
    /** 
     * Get the currently preferred account to use with the app. 
     *  
     * @return The preferred account if available, {@code null} otherwise. 
     */ 
    private Account getPreferenceAccount() {
      return mAccountManager.getAccountByName(mPreferences.getString("selected_account_preference",