0

I try to edit a text of another layout in android. I already inflted the textview but the text don't move ...

View rowLink = getLayoutInflater().inflate(R.layout.nav_header_acceuil, null);
TextView nameText = (TextView) rowLink.findViewById(R.id.nameText);
TextView mailText = (TextView) rowLink.findViewById(R.id.mail);
nameText.setText("test");

no changes on the text ...

Mark Adler
  • 101,978
  • 13
  • 118
  • 158

1 Answers1

0

Actually, i wanted to modify a TextView into a Header layout of a navigationView from the main activity class.

NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
View view = navigationView.inflateHeaderView(R.layout.nav_header_acceuil);
TextView nameText = (TextView) view.findViewById(R.id.nameText);
nameText.setText(prefs.getString("be.mariusvnh.classroom.user.name", "") + " " + prefs.getString("be.mariusvnh.classroom.user.lastName", ""));

That's it , I changed the username connected in the application in the navigationView !! :D