title: Reference view in another layout
body: <p>Is this possible? I have 2 activities and 2 layouts, but I want to reference a view which belongs to another .xml and not the one being inflated by the current activity. How do I do this?</p>
  
  <pre><code>private ChildEventListener pendingListener;
  private ChildEventListener matchesListener;
  private ChildEventListener alertListener;
  private ValueEventListener flightListener;
  private ValueEventListener prefsListener;
  
      protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main_screen);
  
      bLogout = (Button) findViewById(R.id.bLogout);
  
      bLogout.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              logout();
          }
      });
  
  }
  
      private void logout(){
      if(pendingListener != null){
          System.out.println(TAG +" pending listener removed");
          mFirebaseRef
                  .child(FirebaseReference.CHILD_USERS)
                  .child(CURRENT_USER.getId())
                  .child(FirebaseReference.CHILD_PENDING).removeEventListener(pendingListener);
      }
  
      if(matchesListener != null){
          System.out.println(TAG +" accept listener removed");
          mFirebaseRef
                  .child(FirebaseReference.CHILD_USERS)
                  .child(CURRENT_USER.getId())
                  .child(FirebaseReference.CHILD_MATCHES).removeEventListener(matchesListener);
      }
  
      if(flightListener != null){
          System.out.println(TAG + " flight listener removed");
          mFirebaseRef
                  .child(FirebaseReference.CHILD_FLIGHTS)
                  .child(CURRENT_USER.getId()).removeEventListener(flightListener);
      }
  
      if(alertListener != null){
          System.out.println(TAG + " alert listener removed");
          mFirebaseRef.child(FirebaseReference.CHILD_USERS)
                  .child(CURRENT_USER.getId())
                  .child(FirebaseReference.CHILD_ALERTS).removeEventListener(alertListener);
      }
  
      if(prefsListener != null){
          System.out.println(TAG + " prefsListener removed");
          mFirebaseRef.child(FirebaseReference.CHILD_USERS)
                  .child(CURRENT_USER.getId())
                  .child(FirebaseReference.CHILD_PREFS).removeEventListener(prefsListener);
      }
  
      if(this.mAuthData != null){
          mFirebaseRef.removeAuthStateListener(mAuthStateListener);
          System.out.println(TAG + " authState listener removed");
      }
  
      // After logout, go to main activity
      Intent intent = new Intent(MainScreen.this, loginActivity.class);
      intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
      startActivity(intent);
  }
  </code></pre>
  
  <p>The app crashes at .setOnClickListener. bLogout's id is defined in another layout, not main_screen</p>