How to change the title of a menu item in the action bar

view story

http://stackoverflow.com – 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 = findVi (HowTos)