I can not access the views present inside nav_header_main layout
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
//setting profile picture in nav
View emailview=navigationView.getHeaderView(2);
View picview=navigationView.getHeaderView(0);
View nameview=navigationView.getHeaderView(1);
email_textview=(TextView)emailview.findViewById(R.id.emailtextView);
profile_image=(ImageView)picview.findViewById(R.id.profile_imageView);
username_textview=(TextView)nameview.findViewById(R.id.appbarusernametextview);
Intent intent =new Intent(this,EmailPasswordActivity.class);
email=this.getIntent().getExtras().getString("email");
email_textview.setText(email);
when i am using headerinflater it works but adds lots of header
View headerView = navigationView.getHeaderView(0)
email_textview = (TextView)headerView.findViewById(R.id.emailtextView);
profile_image = (ImageView)headerView(R.id.profile_imageView);
username_textview = (TextView)headerView(R.id.appbarusernametextview);
Try This Hope it will help you
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With