So for the menu item, we do in this way
1) To specify the options menu for an activity, override onCreateOptionsMenu(). In this method, you can inflate your menu resource:-
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.game_menu, menu);
    return true;
}
2)Handling click events:
  You can match this ID against known menu items to perform the appropriate action. For example:
 @Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle item selection
    switch (item.getItemId()) {
        case R.id.action_settings:
          // do your work
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
0
solved ‘void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)’ on a null object reference &