title: How to save the details of the account chosen in account chooser dialog box?
body: <p>Below code shows the Account chooser dialog box for the first time when i login to my app and then i choose an account from it .But whichever account i choose ,i want to show its details(<strong>email_id,user_name,user_profile pic</strong>) on the Navigation drawer header .How to show the details of the account?? .</p>
  
  <p><strong>MainActivity.java</strong></p>
  
  <pre><code>  public class MainActivity extends BaseActivity
          implements NavigationView.OnNavigationItemSelectedListener,
          GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
  
      RecyclerView rvHome;
      RVAdapter rvAdapter;
      LinearLayoutManager llm;
      ArrayList&lt;Doc&gt; docs = new ArrayList&lt;&gt;();
      private boolean loading = true;
      private ProgressBar progressBar;
      private long numFound = 0;
      private boolean isFilter = false;
      private String category = "ad_category:3";
      private GoogleApiClient mGoogleApiClient;
      private ConnectionResult mConnectionResult;
      private static final int RC_SIGN_IN = 0;
      private boolean mIntentInProgress;
      private static final int PROFILE_PIC_SIZE = 400;
      CircleImageView profileImage;
      TextView userName;
      TextView userEmail;
      CallbackManager callbackManager;
      ProgressDialog progress;
      SharedPreferences sharedPreferences;
      private boolean isConnected;
      String SCOPE = "oauth2:https://www.googleapis.com/auth/userinfo.profile";
      @TargetApi(Build.VERSION_CODES.LOLLIPOP)
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          long startTime=System.currentTimeMillis();
          requestWindowFeature(Window.FEATURE_ACTIVITY_TRANSITIONS);
          setContentView(R.layout.activity_main);
          Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
          setTitle("Popular Design");
          setColorIndex();
          setColors(this, colorIndex);
          overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
          rvHome = (RecyclerView) findViewById(R.id.rv_home);
          llm = new LinearLayoutManager(MainActivity.this, LinearLayoutManager.VERTICAL, false);
          rvHome.setLayoutManager(llm);
          rvAdapter = new RVAdapter(MainActivity.this);
          rvHome.setAdapter(rvAdapter);
          rvHome.addOnScrollListener(scrollListener);
          progressBar = (ProgressBar) findViewById(R.id.loading_progress);
          progress = new ProgressDialog(this);
          progress.setCancelable(false);
          MyShopApplication application = (MyShopApplication) getApplication();
          Tracker mTracker = application.getDefaultTracker();
          sharedPreferences = getSharedPreferences(AppConstants.USER_PREFERENCES, Context.MODE_PRIVATE);
  
          DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
          ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
                  this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
          drawer.addDrawerListener(toggle);
          toggle.syncState();
  
          NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
          navigationView.setNavigationItemSelectedListener(this);
  
          View hView = navigationView.getHeaderView(0);
          navigationView.setCheckedItem(R.id.home);
          profileImage = (CircleImageView) hView.findViewById(R.id.imageView);
          userName = (TextView) hView.findViewById(R.id.user_name);
          userEmail = (TextView) hView.findViewById(R.id.user_email);
          userName.setText(sharedPreferences.getString(AppConstants.USER_NAME, ""));
          userEmail.setText(sharedPreferences.getString(AppConstants.USER_EMAIL, ""));
          String image_url = sharedPreferences.getString(AppConstants.USER_EMAIL, "");
          if (!image_url.trim().matches("")) {
              Picasso.with(this).load(image_url).into(profileImage);
          }
          checkPermissions();
          callbackManager = CallbackManager.Factory.create();
          mGoogleApiClient = new GoogleApiClient.Builder(MainActivity.this)
                  .addConnectionCallbacks(this)
                  .addOnConnectionFailedListener(this)
                  .addApi(Plus.API)
                  .addScope(Plus.SCOPE_PLUS_PROFILE)
                  .build();
          Utils.TrackTiming(MyShopApplication.getInstance().getDefaultTracker(),AppConstants.ACTIVITY_LOAD,"MAIN_ACTIVITY",System.currentTimeMillis()-startTime,AppConstants.LOADED);
  
      }
  }
  </code></pre>
  
  <p><strong>activity_main.xml</strong></p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/drawer_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:fitsSystemWindows="true"
      tools:openDrawer="start"&gt;
  
      &lt;include
          layout="@layout/app_bar_main"
          android:layout_width="match_parent"
          android:layout_height="match_parent" /&gt;
  
      &lt;android.support.design.widget.NavigationView
          android:id="@+id/nav_view"
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:layout_gravity="start"
          android:fitsSystemWindows="true"
          app:headerLayout="@layout/nav_header_main"
          app:menu="@menu/activity_main_drawer" /&gt;
  
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/FWzN6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FWzN6.png" alt="Navigation_drawer"></a></p>