2017-02-21 69 views
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); 
} 

回答

1

我找到了答案,微博是不是爲我工作,因爲我一個片段 內使用,因此,這就是爲什麼它不工作,我剛剛創建新的活動,現在它的工作

+0

感謝豬頭.... –