FYI I made it like this in the end:
I implemented a separate Activity:
public class MenuActivity extends Activity {
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
openOptionsMenu();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.card_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection.
switch (item.getItemId()) {
case R.id.navigate:
System.out.println("Click");
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public void onOptionsMenuClosed(Menu menu) {
// Nothing else to do, closing the activity.
finish();
}
}
And then I created the intent:
checklistIntent = new Intent(MainActivity.this, MenuActivity.class);
And in my OnItemClick i only do:
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
startActivity(checklistIntent);
}
All the other stuff is the same as before.
Hope this helps someone in the future.