title: Android: Navigation Drawer Header Text View is not setting programmatically
body: <p>In My activity I have fragment so I am using <strong>Navigation</strong> <strong>Drawer</strong>, In the Navigation Drawer I have a <strong>header</strong>  with <strong>TextView</strong>. I want to update it programmatically.</p>
  
  <p><strong>Header.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="190dp"
  android:background="@drawable/background_material"
  android:orientation="vertical"
  &gt;
  
  
  &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="Name Name Name"
      android:textSize="20sp"
      android:textColor="#FFF"
      android:textStyle="bold"
      android:gravity="left"
      android:paddingBottom="4dp"
      android:id="@+id/c"
      android:paddingLeft="10dp"
      android:layout_above="@+id/email"
  
    /&gt;
  
  &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="+919999999999"
      android:id="@+id/email"
      android:gravity="left"
      android:layout_marginBottom="8dp"
      android:paddingLeft="10dp"
      android:textSize="20sp"
      android:textColor="#fff"
      android:layout_alignParentBottom="true"
      android:layout_alignLeft="@+id/username"
      android:layout_alignStart="@+id/username" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>Am Intializing the naviation view by  </p>
  
  <pre><code>  navigationView = (NavigationView) findViewById(R.id.navigation_view);
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/JTfn4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JTfn4.png" alt="enter image description here"></a></p>
  
  <pre><code>TextView txt2;
  txt2 = (TextView)    navigationView.inflateHeaderView(R.layout.nav_header_main).findViewById(R.id.textView2);
   txt2.setText("wow! It works like a charm");
  </code></pre>
  
  <p>But getting Null Pointer exception</p>