I'm currently facing a problem when trying to edit the text of a TextView in the OnCreate method of an Activity. As I understand, setContentView must be called before trying to change the text, however I am still having trouble with this.
Here is the code in question :
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_dash_board);
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
            this, drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    drawer.addDrawerListener(toggle);
    toggle.syncState();
    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);
    userEmailtext = (TextView) findViewById(R.id.emailText);
    mAuth = FirebaseAuth.getInstance();
    mUser = mAuth.getCurrentUser();
    userEmailtext.setText("This Does Not Work");
}
This Activity includes the Android Studio default sliding menu. The aim of this setText is to change the email address text of the sliding menu. I believe the problem may lie in the fact that the sliding menu is part of a different layout file, meaning there is no "emailText" textview leading to the null pointer exception, however I am still not sure how this would be rectified.
Any help is appreciated.
 
     
     
    