I am working for the first time with the Navigation Drawer Activity, and would like to change (by java) the text that appears in the menu nav_header_main.xml
Inredit'sthetextthatIwanttochange.
Belowisthexmlautomaticallygeneratedbyandroidstudio,IjustaddedanIDtothisTextView:
TextViewandroid: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 the onCreate class MainActivity.java I made the following codes:
TextView txtUsuarioLogado = (TextView) findViewById(R.id.txtUsuarioLogado);
txtUsuarioLogado.setText("Nome Alterado");
However, the TextView is always getting null, locking the application. How would the correct way of manipulating it