I'm trying to access the setOnMenuItemClickedListener but i get a null object reference. The error message isn't very specific and doesn't tell me which object caused the null reference. I've already clearly defined the MenuItem object using findViewById. The menu item itself is in a "android.support.v4.widget.DrawerLayout" which is the root of the main activity.
MenuItem item1 = findViewById(R.id.restore);
item1.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
return false;
}
});
All of the code above is within the mainactivites oncreate bundle function.