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);
(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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.