0
登錄後嘰嘰喳喳不回來OnActivityResult,我使用的片段爲這個Twitter的整合
這裏 是我的代碼Twitter的整合不返回OnActivityResult
我跟着這個教程https://docs.fabric.io
TwitterAuthConfig twitterAuthConfig = new TwitterAuthConfig(TwitterKey,TwitterSecretKey);
Fabric.with(getContext(),new Twitter(twitterAuthConfig));
......
twitterLoginButton.setCallback(new Callback<TwitterSession>() {
@Override
public void success(Result<TwitterSession> result) {
Log.d("TwitterKit", "Twitter Result "+ result);
Twitter.getInstance().core.getSessionManager().getActiveSession()
TwitterSession session = result.data;
String msg = "@" + session.getUserName() + " logged in! (#" + session.getUserId() + ")";
Log.d("TwitterKit", "Twitter Result "+msg);
Toast.makeText(getContext(), msg, Toast.LENGTH_LONG).show();
}
@Override
public void failure(TwitterException exception) {
Log.d("TwitterKit", "Login with Twitter failure", exception);
}
});
....
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Log.d("APP_LOG ", " requestCode " + requestCode + " resultscode: " + resultCode + " Data " + data);
loginButton.onActivityResult(requestCode, resultCode, data);
}
感謝豬頭.... –