抱歉我的英文。我无法理解为什么我无法在app中授权。我使用twitter文档,但是当我在twitter中输入登录名和密码时,没有任何反应,代码中的回调不起作用。
对于图片中的链接感到抱歉,我没有15点声誉
我在Twitter中的设置:
当我点击此按钮时,没有任何反应:
我的代码:
TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
Fabric.with(this, new Twitter(authConfig));
setContentView(R.layout.activity_main);
status = (TextView)findViewById(R.id.status);
status.setText("Status: Ready");
loginButton = (TwitterLoginButton) findViewById(R.id.twitter_login_button);
loginButton.setCallback(new Callback<TwitterSession>() {
@Override
public void success(Result<TwitterSession> result) {
Log.e("success", "success");
// The TwitterSession is also available through:
// Twitter.getInstance().core.getSessionManager().getActiveSession()
TwitterSession session = result.data;
// TODO: Remove toast and use the TwitterSession's userID
// with your app's user model
String msg = "@" + session.getUserName() + " logged in! (#" + session.getUserId() + ")";
Log.e("msg", msg);
Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
}
@Override
public void failure(TwitterException exception) {
status.setText("Status: Login Failed");
Toast.makeText(getApplicationContext(), exception.toString(), Toast.LENGTH_SHORT).show();
Log.d("error", "Login with Twitter failure", exception);
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// Make sure that the loginButton hears the result from any
// Activity that it triggered.
loginButton.onActivityResult(requestCode, resultCode, data);
}
在调试器中未输入此行:loginButton.onActivityResult(requestCode, resultCode, data);
我不知道为什么它不起作用。