我有一個按此步驟創建的Twitter登錄http://docs.fabric.io/android/twitter/authentication.html,它顯示用戶名,除了用戶的全名。Android如何在通過Twitter身份驗證後獲取用戶的全名
這是我的代碼如下
loginButton.setCallback(new Callback<TwitterSession>() {
@Override
public void success(Result<TwitterSession> result) {
// Do something with result, which provides a TwitterSession for making API calls
TwitterSession session = Twitter.getSessionManager().getActiveSession();
TwitterAuthToken authToken = session.getAuthToken();
String token = authToken.token;
String secret = authToken.secret;
long userID = result.data.getUserId();
//This throws an Error Cannot find symbol showUser()
User user = twitter.showUser(userID);
//This throws error as well
String fullname= user.getName();
Log.d("login:", "twitter:success");
Log.d("username", result.data.getUserName());
Log.d("full name", fullname);
}
@Override
public void failure(TwitterException exception) {
// Do something on failure
}
});
請我究竟能得到用戶的全名?
使用TwitterApiClient:https://docs.fabric.io/android/twitter /access-rest-api.html –