finditem() doesn't find menu, stuck with NullPointerException
- by fdansv
I'm stuck while changing some properties on my options menu at onCreateOptionsMenu(). It seems like findItem() returns null, even though I'm pretty sure that the reference to the menu item is correct. My code looks as follows:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_profile, menu);
MenuItem leftie = menu.findItem(R.id.menu_profile);
leftie.setIcon(R.drawable.ic_menu_mapmode);
leftie.setTitle(R.string.back_map);
leftie.setIntent(authIntent);
return true;
}
I really don't know what can be wrong there. Thanks in advance :)
EDIT: I forgot to include the actual problem.