@Override public void onComplete(SHARE_MEDIA platform, int action, Map<String, String> data) { Toast.makeText(getApplicationContext(), "授权成功", Toast.LENGTH_SHORT).show(); mShareAPI.getPlatformInfo( LoginActivity.this, SHARE_MEDIA.WEIXIN, new UMAuthListener() { @Override public void onComplete(SHARE_MEDIA share_media, int i, Map<String, String> map) { if (map != null) { String openid = map.get("openid").toString(); String nickname = map.get("nickname").toString(); String headimgurl = map.get("headimgurl").toString(); WXloading(openid, nickname, headimgurl); } else { Toast.makeText(getApplicationContext(), "没有授权", Toast.LENGTH_SHORT).show(); } } @Override public void onError(SHARE_MEDIA share_media, int i, Throwable throwable) {} @Override public void onCancel(SHARE_MEDIA share_media, int i) {} }); }
@Override public void onClick(View v) { switch (v.getId()) { case R.id.bt_login: // 登陆请求. confirmLogin(); // lOGON(); if (i == 0) { i++; llCode.setVisibility(View.VISIBLE); } else { i = 0; llCode.setVisibility(View.GONE); } break; case R.id.imageView_weixin: // 授权微信 mShareAPI.doOauthVerify(LoginActivity.this, SHARE_MEDIA.WEIXIN, umAuthListeners); // mShareAPI.getPlatformInfo(LoginActivity.this, // SHARE_MEDIA.WEIXIN, // umAuthListener); break; case R.id.imageView_qq: // 授权腾讯 mShareAPI.doOauthVerify(LoginActivity.this, SHARE_MEDIA.QQ, umAuthListener); break; case R.id.imageView_weibo: // 授权微博 mShareAPI.doOauthVerify(LoginActivity.this, SHARE_MEDIA.SINA, umAuthListener); break; case R.id.login_but: // new AsnyckLogin().execute(); mShareAPI.getPlatformInfo(LoginActivity.this, SHARE_MEDIA.WEIXIN, umAuthListener); break; case R.id.login_but1: // lOGON(); break; default: break; } }