Android Person - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Person class.

This code example shows how to use the following methods:getCover, getCurrentLocation, getDisplayName, getGender, getImage
	/** 
	 * Build the bragging of the this.person 
	 */ 
	private void buildUserMajorInformation() { 
		// Cover 
		Cover mPhotoCover = gPlusGuy.getCover();
		CoverPhoto coverPhoto = mPhotoCover.getCoverPhoto();
		setTextViewText(coverPhoto.getUrl());
		// Name 
		setTextViewText(gPlusGuy.getDisplayName());
		// RelationShip and Gender 
		setTextViewText(""+gPlusGuy.getRelationshipStatus());
		setTextViewText(""+gPlusGuy.getGender());
		// Person's picture 
		Person.Image mImage = gPlusGuy.getImage();
		setTextViewText(mImage.getUrl());
		 
		// Location 
		setTextViewText(gPlusGuy.getCurrentLocation());
		// Language 

5
CodeRank
This code example shows how to use the following methods:getAgeRange, getBirthday, getDisplayName
	 */ 
	@Override 
	public void onSignedIn(PlusClient plusClient) {
		if (plusClient.isConnected()) {
			mPlusPerson = plusClient.getCurrentPerson();
			Log.v(TAG_LOGIN_ACTIVITY, "Display Name=="+mPlusPerson.getDisplayName());
			Log.v(TAG_LOGIN_ACTIVITY, "Birthday=="+mPlusPerson.getBirthday());
			Log.v(TAG_LOGIN_ACTIVITY, "Age Range=="+mPlusPerson.getAgeRange());
 
			// Retrieve the account name of the user which allows us to retrieve 
			// the OAuth access token. 
			final String accountName = plusClient.getAccountName();
			Log.v(TAG_LOGIN_ACTIVITY, "account name=="+accountName);
		} 
	} 
 
	/** 
	 * Invoked when the {@link PlusClientFragment} delegate has failed to 
	 * authenticate the user. Failure to authenticate will often mean that the 
	 * user has not yet chosen to sign in. 
5
CodeRank
This code example shows how to use the following methods:getBirthday, getDisplayName
 
    private String getHangoutParticipants() {
        Person currentPerson = mPlusClient.getCurrentPerson();
        StringBuilder sb = new StringBuilder();
        sb.append("The crazy information people can get when you accept permissions:").append("\n");
        sb.append("Name:" + currentPerson.getDisplayName()).append("\n");
        sb.append("Birthday:" + currentPerson.getBirthday()).append("\n");
        Location mCurrentLocation = mLocationClient.getLastLocation();
        sb.append("Current location:").append("\n").append("Lat:").append(mCurrentLocation.getLatitude()).append("\n").append("Log:").append(mCurrentLocation.getLongitude());
        return sb.toString();
    } 
 
    @Override 
    protected void onActivityResult(int requestCode, int responseCode, Intent intent) {
        super.onActivityResult(requestCode, responseCode, intent);
        if (requestCode == REQUEST_CODE_RESOLVE_ERR && responseCode == RESULT_OK) {
            mConnectionResult = null;
            mPlusClient.connect();
        } 
 
4
CodeRank
This code example shows how to use the following methods:getDisplayName
 
        TextView userNameTxtView = (TextView) v.findViewById(R.id.user_name);
 
        TextView userActivityTxtView = (TextView) v.findViewById(R.id.user_activity);
 
        userNameTxtView.setText(currentPerson.getDisplayName());
 
        userActivityTxtView.setText(currentPersonActivity == null ? "" : currentPersonActivity);
 
        imageView.setBackgroundDrawable(new BitmapDrawable(mIcon11));
        // Returning the view containing InfoWindow contents 
        return v;
    } 
 
    private class DownloadImageTask extends AsyncTask<String, Void, Bitmap> {
 
        protected Bitmap doInBackground(String... urls) {
            loadedImageUrl = urls[0];
            mIcon11 = null;
            try { 
4
CodeRank
This code example shows how to use the following methods:getDisplayName
    @Override 
    public void onPersonLoaded(ConnectionResult status, Person person) {
 
        if (status.getErrorCode() == ConnectionResult.SUCCESS) {
        	Log.i("cTest", "Successful Retrieval of Profile information");
            userName = person.getDisplayName();    
        } 
 
    } 
     
 
} 
4
CodeRank
This code example shows how to use the following methods:getDisplayName
	public void onConnected(Bundle connectionHint) {
 
		if (client.isConnected() && dialog.isShowing()) {
			dialog.cancel();
			Person person = client.getCurrentPerson();
			addPlusFragment(person.getDisplayName(), client,plusClient);
		} 
	} 
 
	@Override 
	public void onDisconnected() { 
 
	} 
 
	@Override 
	public void onConnectionFailed(ConnectionResult result) {
		if (result.hasResolution()) {
			try { 
				result.startResolutionForResult(MainActivity.this, REQUEST_CODE);
			} catch (SendIntentException e) {
4
CodeRank
This code example shows how to use the following methods:getAboutMe, getBirthday, getDisplayName, getGender, getId
	 */ 
	public UserProfile (Person person, String accountName) {
		 
		// Setup Google login parameters 
		googleUsername = accountName;
		googleId = person.getId();
 
		name = person.getDisplayName();
		email = accountName;
		 
		if (person.hasGender()) {
			switch (person.getGender()) {
			case Person.Gender.MALE:
				gender = "male";
				break; 
			case Person.Gender.FEMALE:
				gender = "female";
				break; 
			case Person.Gender.OTHER:
				gender = "other";

3
CodeRank

Related Android Person Questions & Answers:

Other Android Person Examples

184:			try {
185:				if (Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) != null) {
186:					Person currentPerson = Plus.PeopleApi
187:							.getCurrentPerson(mGoogleApiClient);
188:					String personName = currentPerson.getDisplayName();

Read More

See Code Examples for Android Person Methods: