X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/b66e309dfa8b145a293cb47b7cbcf588dc0c79ab..c75e5aa71cf93e677e5abb95cb3d9c1f45a64ea7:/src/com/owncloud/android/ui/activity/AccountSelectActivity.java diff --git a/src/com/owncloud/android/ui/activity/AccountSelectActivity.java b/src/com/owncloud/android/ui/activity/AccountSelectActivity.java index f5d06dcb..1b73c86e 100644 --- a/src/com/owncloud/android/ui/activity/AccountSelectActivity.java +++ b/src/com/owncloud/android/ui/activity/AccountSelectActivity.java @@ -199,22 +199,33 @@ public class AccountSelectActivity extends SherlockListActivity implements AccountManager am = (AccountManager) getSystemService(ACCOUNT_SERVICE); Account accounts[] = am .getAccountsByType(MainApp.getAccountType()); - LinkedList> ll = new LinkedList>(); - for (Account a : accounts) { - HashMap h = new HashMap(); - h.put("NAME", a.name); - h.put("VER", - "ownCloud version: " - + am.getUserData(a, - AccountAuthenticator.KEY_OC_VERSION)); - ll.add(h); + if (am.getAccountsByType(MainApp.getAccountType()).length == 0) { + // Show create account screen if there isn't any account + am.addAccount(MainApp.getAccountType(), + null, + null, + null, + this, + null, + null); } + else { + LinkedList> ll = new LinkedList>(); + for (Account a : accounts) { + HashMap h = new HashMap(); + h.put("NAME", a.name); + h.put("VER", + "ownCloud version: " + + am.getUserData(a, + AccountAuthenticator.KEY_OC_VERSION)); + ll.add(h); + } - setListAdapter(new AccountCheckedSimpleAdepter(this, ll, - android.R.layout.simple_list_item_single_choice, - new String[] { "NAME" }, new int[] { android.R.id.text1 })); - registerForContextMenu(getListView()); - + setListAdapter(new AccountCheckedSimpleAdepter(this, ll, + android.R.layout.simple_list_item_single_choice, + new String[] { "NAME" }, new int[] { android.R.id.text1 })); + registerForContextMenu(getListView()); + } } @Override