Firdoesh Khan Firdoesh Khan - 4 months ago 8x
Android Question

How to show google profile name in another activity

Hello i am building one app which will take google profile name and then it will be displayed in another activity as EditText.


private void getProfileInformation() {
try {
if (Plus.PeopleApi.getCurrentPerson(mGoogleApiClient) != null) {
Person currentPerson = Plus.PeopleApi
String personName = currentPerson.getDisplayName();
String personPhotoUrl = currentPerson.getImage().getUrl();
String personGooglePlusProfile = currentPerson.getUrl();
String email = Plus.AccountApi.getAccountName(mGoogleApiClient);

// by default the profile url gives 50x50 px image only
// we can replace the value with whatever dimension we want by
// replacing sz=X
personPhotoUrl = personPhotoUrl.substring(0,
personPhotoUrl.length() - 2)
+ 400;

new LoadProfileImage(imageView_profile_image).execute(personPhotoUrl);

} else {
"Person information is null", Toast.LENGTH_LONG).show();

any idea how to take name from this and display it in EditText


profilename = (EditText)findViewbyId(;


(I posted it as a comment but I think it solved the issue, so I post it as answer and add some explanation)

Have a look at these links : 1 2 3. A Bundle is exactly what you need.

This code is taken from one of the links and it's what you need. It saves a value on the Bundle:


Intent mIntent = new Intent(this, Example.class);
Bundle extras = mIntent.getExtras();
extras.putString(key, value);  // <-- key is the same 

Then, on your ActivityUser add the following (note that key variable must be the same in both Activity):


String value = getIntent().getExtras().getString(key); // <-- as the key here