Ad

Displaying Facebook Username In Navigation Drawer Activitys Navigation Header Layout In Textview

My navigation Header layout

My main code where i want to use it

i dont know how to use it can anyone explain me how this can be done i already use some solutions but didnt work it does not show me the name on textview but i displayed in toast it is displaying and i inflate the view but still cant used then i programmatically hardcode string my app is crashing now please help me to find a suitable solution for this problem

Ad

Answer

Try This

NavigationView navigationView = (NavigationView) findViewById(R.id.your_navigation_view_id);//navigation view id
View hView = navigationView.getHeaderView(0);
TextView tv= (TextView) hView.findViewById(R.id.text);

Then use

tv.setText("");

inside the onCompleted() method.

Ad
source: stackoverflow.com
Ad