@Override
 public boolean handleMessage(Message msg) {
   // TODO Auto-generated method stub
   switch (msg.what) {
     case Constants.MSG_USERID_FOUND:
       Toast.makeText(this, R.string.userid_found, Toast.LENGTH_SHORT).show();
       break;
     case Constants.MSG_LOGIN:
       bindOpenId = (String) msg.obj;
       // 绑定wechat账号
       bindWechatAccount(bindOpenId);
       break;
     case Constants.MSG_AUTH_CANCEL:
       Toast.makeText(this, R.string.auth_cancel, Toast.LENGTH_SHORT).show();
       break;
     case Constants.MSG_AUTH_ERROR:
       // 失败
       String expName = msg.obj.getClass().getSimpleName();
       if ("WechatClientNotExistException".equals(expName)
           || "WechatTimelineNotSupportedException".equals(expName)
           || "WechatFavoriteNotSupportedException".equals(expName)) {
         int resId = getStringRes(this, "wechat_client_inavailable");
         if (resId > 0) {
           showNotification(this.getString(resId));
         }
       }
       break;
     case Constants.MSG_AUTH_COMPLETE:
       SharedPreferencesUtil.putValue(this, Constants.HEAD_IMG_URL, (String) msg.obj);
       Toast.makeText(this, R.string.auth_complete, Toast.LENGTH_SHORT).show();
       break;
   }
   return false;
 }
  /** 在list中移除绑定 */
  private void removeBindAccountInList(String remove_open_id) {
    for (int i = 0; i < userAccountManagerDTOs.size(); i++) {
      UserAccountManagerDTO dto = userAccountManagerDTOs.get(i);
      if (remove_open_id.equals(dto.getBindValue())) {
        dto.setBindValue(null);
        // 删除根据open_id 自动登录
        SharedPreferencesUtil.putValue(this, Constants.KLOGIN_THIRD_ACCOUNT, null);

        String auth_type = SharedPreferencesUtil.getValue(this, Constants.kLOGIN_AUTH_TYPE, null);
        if (auth_type != null) {
          if (Constants.kAUTH_TYPE_QQ.equals(auth_type)
              || Constants.kAUTH_TYPE_SINA_WEIBO.equals(auth_type)
              || Constants.kAUTH_TYPE_WECHAT.equals(auth_type)) { // 如果是用第三方登录支付
            String openId =
                SharedPreferencesUtil.getValue(this, Constants.KLOGIN_THIRD_ACCOUNT, null);
            if (remove_open_id.equals(openId)) {
              SharedPreferencesUtil.putValue(this, Constants.KLOGIN_THIRD_ACCOUNT, null);
            }
          }
        }
      }
    }
  }
  /** 获取第三方的头像 */
  private void getUserPhotoInThird(String login_type, final String bindValue) {
    if (authHelper.isSessionValid(login_type)) {
      processDialog.show();
      if (Constants.LOGIN_TYPE_QQ.equals(login_type)) {
        authHelper.getUserInfoInQQ(
            new IUiListener() {

              @Override
              public void onError(UiError arg0) {
                if (processDialog != null && processDialog.isShowing()) {
                  processDialog.dismiss();
                }
              }

              @Override
              public void onComplete(Object response) {
                JSONObject json = (JSONObject) response;
                Log.i(TAG, response + "");
                if (json.has("figureurl_qq_2")) {
                  try {
                    // 获取第三方账户头像
                    String url = json.getString("figureurl_qq_2");

                    // 同时用获取的头像,创建账号
                    Log.i(TAG, url);
                    bindThirdPhoto(BUND_TYPE_QQ, bindValue, url);

                  } catch (JSONException e) {
                    e.printStackTrace();
                  }
                }
              }

              @Override
              public void onCancel() {
                if (processDialog != null && processDialog.isShowing()) {
                  processDialog.dismiss();
                }
              }
            });
      }
      if (BUND_TYPE_WECHAT.equals(login_type)) {
        // 同时用获取的头像,创建账号
        bindThirdPhoto(
            BUND_TYPE_WECHAT,
            bindValue,
            SharedPreferencesUtil.getValue(this, Constants.HEAD_IMG_URL, ""));
      }
      if (Constants.LOGIN_TYPE_WEIBO.equals(login_type)) {
        authHelper.getUserInfoInWeibo(
            new com.sina.weibo.sdk.net.RequestListener() {

              @Override
              public void onWeiboException(WeiboException exc) {
                Log.e(TAG, exc.getMessage());
                if (processDialog != null && processDialog.isShowing()) {
                  processDialog.dismiss();
                }
              }

              @Override
              public void onComplete(String response) {
                if (!TextUtils.isEmpty(response)) {
                  User user = User.parse(response);
                  Log.i(TAG, "微博头像 :" + user.profile_image_url);
                  bindThirdPhoto("weiBo", bindValue, user.profile_image_url);
                  // 同时用获取的头像,创建账号

                }
              }
            });
      }
    }
  }