com.google.android.gms.games.Player

Here are the examples of the java api class com.google.android.gms.games.Player taken from open source projects.

1. BeGenerousActivity#showSignOutBar()

Project: android-basic-samples
File: BeGenerousActivity.java
// Shows the "sign out" bar (explanation and button).
private void showSignOutBar() {
    findViewById(R.id.sign_in_bar).setVisibility(View.GONE);
    findViewById(R.id.sign_out_bar).setVisibility(View.VISIBLE);
    Player player = Games.Players.getCurrentPlayer(mGoogleApiClient);
    String url = player.getIconImageUrl();
    TextView name = (TextView) findViewById(R.id.playerName);
    name.setText(player.getDisplayName());
    if (url != null) {
        ImageView vw = (ImageView) findViewById(R.id.avatar);
        // load the image in the background.
        new DownloadImageTask(vw).execute(url);
    }
    String email = Plus.AccountApi.getAccountName(mGoogleApiClient);
    TextView emailView = (TextView) findViewById((R.id.playerEmail));
    emailView.setText(email);
}

2. MainActivity#onConnected()

Project: android-basic-samples
File: MainActivity.java
@Override
public void onConnected(Bundle bundle) {
    Log.d(TAG, "onConnected(): connected to Google APIs");
    // Show sign-out button on main menu
    mMainMenuFragment.setShowSignInButton(false);
    // Show "you are signed in" message on win screen, with no sign in button.
    mWinFragment.setShowSignInButton(false);
    // Set the greeting appropriately on main menu
    Player p = Games.Players.getCurrentPlayer(mGoogleApiClient);
    String displayName;
    if (p == null) {
        Log.w(TAG, "mGamesClient.getCurrentPlayer() is NULL!");
        displayName = "???";
    } else {
        displayName = p.getDisplayName();
    }
    mMainMenuFragment.setGreeting("Hello, " + displayName);
    // if we have accomplishments to push, push them
    if (!mOutbox.isEmpty()) {
        pushAccomplishments();
        Toast.makeText(this, getString(R.string.your_progress_will_be_uploaded), Toast.LENGTH_LONG).show();
    }
}