public void onOAuthDone(OAuth result) { if (result == null) { Toast.makeText( this, "Authorization failed", //$NON-NLS-1$ Toast.LENGTH_LONG) .show(); } else { User user = result.getUser(); OAuthToken token = result.getToken(); if (user == null || user.getId() == null || token == null || token.getOauthToken() == null || token.getOauthTokenSecret() == null) { Toast.makeText( this, "Authorization failed", //$NON-NLS-1$ Toast.LENGTH_LONG) .show(); return; } String message = String.format( Locale.US, "Authorization Succeed: user=%s, userId=%s, oauthToken=%s, tokenSecret=%s", //$NON-NLS-1$ user.getUsername(), user.getId(), token.getOauthToken(), token.getOauthTokenSecret()); Toast.makeText(this, message, Toast.LENGTH_LONG).show(); saveOAuthToken( user.getUsername(), user.getId(), token.getOauthToken(), token.getOauthTokenSecret()); load(result); } }
public void setUser(User user) { textUserTitle.setText(user.getUsername()); textUserName.setText(user.getRealName()); textUserId.setText(user.getId()); }