I'm trying to change the title of one of my actionbar menu items. When the user isn't logged in it says Login which is the normal title for it, but once the user logs in I want it to change to logout. What I have right now was just to test if I could get it to work but whenever I run it with the code to change the title it crashes.
Here's the code:
public MenuItem logout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
background = findViewById(R.id.status);
status = findViewById(R.id.image);
logout = (MenuItem) findViewById(R.id.menu_login);
logout.setTitle("Blah");
new CheckStatusTask().execute();
}