0
I am working for the first time with Navigation Drawer Activity, and would like to change (by java) the text that appears in the nav_header_main.xml menu
In red is the text I want to change.
Below is the xml generated automatically by android studio, I just added an ID to this Textview:
TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:text="Android Studio"
android:id="@+id/txtUsuarioLogado"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
So, in onCreate of the Mainactivity.java class I made the following codes:
TextView txtUsuarioLogado = (TextView) findViewById(R.id.txtUsuarioLogado);
txtUsuarioLogado.setText("Nome Alterado");
However, Textview is always getting null value, locking the application. How would be the correct way to manipulate it