I want to set text to the navigation drawers headers text, I searched a lot but everyone does it by inflating a layout but for me it creates 2 headers so is there any way to
You get navigation header view by navigationView.getHeaderView(0) , try code below
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
View header=navigationView.getHeaderView(0);
/*View view=navigationView.inflateHeaderView(R.layout.nav_header_main);*/
name = (TextView)header.findViewById(R.id.username);
email = (TextView)header.findViewById(R.id.email);
name.setText(personName);
email.setText(personEmail);