0

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

ActivityGoogle

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

            // 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 {
            Toast.makeText(getApplicationContext(),
                    "Person information is null", Toast.LENGTH_LONG).show();

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

ActivityUser

profilename = (EditText)findViewbyId(R.id.profilename);
  • You should really learn the basics of Android programming. Have a look at these links : [1](https://developer.android.com/reference/android/os/Bundle.html) [2](http://stackoverflow.com/questions/4999991/what-is-a-bundle-in-an-android-application) [3](http://stackoverflow.com/questions/768969/passing-a-bundle-on-startactivity). A `Bundle` is exactly what you need. – UDKOX May 30 '16 at 20:51

1 Answers1

0

(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:

ActivityGoogle

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):

ActivityUser

String value = getIntent().getExtras().getString(key); // <-- as the key here
Community
  • 1
  • 1
UDKOX
  • 738
  • 3
  • 15