2016-05-30 7 views
0

こんにちは私はGoogleのプロフィール名を取る1つのアプリを作っています。それはEditTextとして別のアクティビティに表示されます。 EditText別のアクティビティでGoogleのプロフィール名を表示するには

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(); 

これから名前を取り、それを表示するにはどのように任意のアイデア

ActivityUser

profilename = (EditText)findViewbyId(R.id.profilename); 
+0

あなたは本当にAndroidプログラミングの基礎を学ぶべきです。これらのリンクを見てください:[1](https://developer.android.com/reference/android/os/Bundle.html)[2](http://stackoverflow.com/questions/4999991/what-is) - アンドロイドアプリケーションでのバンドル)[3](http://stackoverflow.com/questions/768969/passing-a-bundle-on-startactivity) 「バンドル」はまさにあなたが必要とするものです。 – UDKOX

答えて

0

(私はコメントとして投稿が、私はそれを解決だと思います問題として、回答として投稿して説明を追加します)

これらのリンクをご覧ください:123 A Bundleはあなたが必要とするものです。

このコードはリンクの1つから取られ、必要なものです。それはBundle上の値保存されます。

ActivityUser:ActivityUserは以下を追加するには、

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

その後

ActivityGoogleを(key変数は、両方のActivityで同じでなければならないことに注意してください)

String value = getIntent().getExtras().getString(key); // <-- as the key here 
関連する問題