+
+ /**
+ * Create the list of accounts that have been added into the app
+ *
+ * @param accountsPrefCategory
+ */
+ private void createAccountsCheckboxPreferences(PreferenceCategory accountsPrefCategory) {
+ AccountManager am = (AccountManager) getSystemService(ACCOUNT_SERVICE);
+ Account accounts[] = am.getAccountsByType(MainApp.getAccountType());
+ Account currentAccount = AccountUtils.getCurrentOwnCloudAccount(getApplicationContext());
+ for (Account a : accounts) {
+ CheckBoxPreference checkBoxPreference = new CheckBoxPreference(this);
+ checkBoxPreference.setKey(a.name);
+ checkBoxPreference.setTitle(a.name);
+
+ // Check the current account that is being used
+ if (a.name.equals(currentAccount.name)) {
+ checkBoxPreference.setChecked(true);
+ }
+
+ accountsPrefCategory.addPreference(checkBoxPreference);
+ }
+ }