@Override public WeiBoUser workInBackground(String... params) throws TaskException { // 1、请求授权 AccessToken accessToken = SinaSDK.getInstance(null).getAccessToken(params[0]); AccountBean account = new AccountBean(); account.setToken(accessToken); // 2、加载用户信息 publishProgress(R.string.account_load_userinfo); WeiBoUser user = SinaSDK.getInstance(accessToken).userShow(accessToken.getUid(), null); // 3、加载分组信息 publishProgress(R.string.account_load_groups); Groups groups = SinaSDK.getInstance(accessToken).friendshipGroups(); // 4、更新新账户到DB account.setUser(user); account.setGroups(groups); account.setAccount(mAccount); account.setPassword(mPassword); account.setUserId(user.getIdstr()); // 2014-09-18 移除了所有账户信息,包括LoggedIn,所以需要调用AccountFragment.login() AccountDB.remove(account.getUserId()); AccountDB.newAccount(account); if (AppContext.isLogedin() && // 2014-09-18 仅更新登录用户数据 AppContext.getUser().getIdstr().equals(user.getIdstr())) { AccountFragment.login(account, false); } if (getActivity() != null) { Intent data = new Intent(); data.putExtra("token", accessToken); getActivity().setResult(Activity.RESULT_OK, data); } return user; }