private void getBranches() { GetRepoBranchesClient repoBranchesClient = new GetRepoBranchesClient(getActivity(), repoInfo); repoBranchesClient .observable() .observeOn(AndroidSchedulers.mainThread()) .subscribe( new BranchesCallback(repoInfo) { @Override protected void showBranches(String[] branches, int defaultBranchPosition) { if (branches != null && branches.length > 0) { pref_repo_default_branch.setEntries(branches); pref_repo_default_branch.setEntryValues(branches); pref_repo_default_branch.setValueIndex(defaultBranchPosition); pref_repo_default_branch.setEnabled(true); } } }); }