+ \r
+ /**\r
+ * Can be used to get the currently selected ownCloud account in the preferences\r
+ * \r
+ * @param context The current appContext\r
+ * @return The current account or null, if there is none yet.\r
+ */\r
+ public static Account getCurrentOwnCloudAccount(Context context){\r
+ Account[] ocAccounts = AccountManager.get(context).getAccountsByType(AccountAuthenticator.ACCOUNT_TYPE);\r
+ Account defaultAccount = null;\r
+ \r
+ SharedPreferences appPreferences = PreferenceManager.getDefaultSharedPreferences(context);\r
+ String accountName = appPreferences.getString("select_oc_account", null);\r
+ \r
+ if(accountName != null){\r
+ for(Account account : ocAccounts){\r
+ if(account.name.equals(accountName)){\r
+ defaultAccount = account;\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ \r
+ return defaultAccount;\r
+ }\r