title: NullPointerException for OnClickerListener of Google Sign in buttons
body: <p>I am getting this error with 2 of my buttons.</p>
  
  <pre><code> Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.android.gms.common.SignInButton.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
  </code></pre>
  
  <p>Here is the code:</p>
  
  <pre><code>    btn_signin = findViewById(R.id.signin_btn);
      btn_signin.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              signIn();
          }
      });
  
      btn_signout = (Button)findViewById(R.id.signout_btn);
      btn_signout.setOnClickListener(new View.OnClickListener(){
          @Override
          public void onClick(View v) {
              FirebaseAuth.getInstance().signOut();
              Auth.GoogleSignInApi.signOut(mGoogleApiClient).setResultCallback(
                      new ResultCallback&lt;Status&gt;() {
                          @Override
                          public void onResult(@NonNull Status status) {
                              btn_signin.setVisibility(View.VISIBLE);
                              btn_signout.setVisibility(View.GONE);
                              emailText.setText(" ".toString());
                              nameText.setText(" ".toString());
                          }
                      });
          }
  
      });
  </code></pre>
  
  <p>How can I solve this problem? Why is it working on every other button but not these two?</p>
  
  <p>Edit: The buttons are in the header of navigation if that matters. Here is the relevant part from xml file:</p>
  
  <pre><code>&lt;com.google.android.gms.common.SignInButton
      android:id="@+id/signin_btn"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" /&gt;
  &lt;Button
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:id="@+id/signout_btn"
      android:visibility="gone"
      android:text="Sign Out"/&gt;
  
  &lt;TextView
      android:id="@+id/name"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textColor="@color/colorAccent"
      android:textStyle="bold" /&gt;
  &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/email"
      android:textColor="@color/colorPrimary"
      android:textStyle="bold"/&gt;
  </code></pre>