I have a activity_main.xml with a NavigationView like this:
<android.support.design.widget.NavigationView
android:id="@+id/nav_drawer"
android:layout_width="320dp"
android:layout_height="match_parent"
android:layout_gravity="start"
app:menu="@menu/menu_drawer"
app:headerLayout="@layout/header"
app:itemIconTint="@color/colorAccent"
/>
I have a header layout and there is a textview there. I was wondering how I can access that textview? I have code in my main activity which will update that textview but I am unsure how to have access to that textview. The header.xml is not part of an activity.
In my main activity I have this piece of code:
public void checkCurrentUser() {
ParseUser user = ParseUser.getCurrentUser();
if (user != null) {
nameOfCurrentUser.setText(user.getUsername());
}
}
which will update that textview with the current user's username