private void init() { try { names = HMApiChat.getInstance().userList(); adapter = new CommonAdapter<String>(getActivity(), names, R.layout.chat_adapter_index_contacts) { @Override public void dealViews(ViewHolder holder, List<String> datas, int position) { dealAdapterViews(holder, datas, position); } }; lvSession.setAdapter(adapter); } catch (Exception e) { ToastUtil.printErr(e); } }
@Override public void setRequestSuc(String url, int statusCode, Header[] headers, JsonObject jo) { super.setRequestSuc(url, statusCode, headers, jo); if (url.equals(HMApiUser.REGISTER)) { HMUserBean userbean = GsonUtil.fromJsonObj(jo.getAsJsonObject(HMApiUser.KEY_DATA), HMUserBean.class); userbean.setPassword(password); ((HMApp) getApplication()).getUserSP().saveUserBean(userbean); // 聊天系统注册 HMApiChat.getInstance().register(this, phone, password); // 成功后默认登录 RequestParams params = new RequestParams(); params.put("accountName", phone); params.put("password", password); HMApiUser.getInstance().postLoginOnBack(((HMApp) getApplication()), userbean); HMNavUtil.goToNewAct(this, HMRegisterInfoAct.class); onBack(null); } }