Menu button can only be clicked one time
<p>I added a custom menu to the menu button using the following code:</p>

<pre><code>@Override
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);
        if (getDisplayedView() instanceof WorkspaceView) {
            ((WorkspaceView) getDisplayedView()).showEditMenu();
        }
        return true;
    }
</code></pre>

<p>and</p>

<pre><code>public void showEditMenu() {
        new EditMenu(lexs, ((Project) projects.getSelectedItem()).getName(), ((ProjectList) projectsList.getSelectedItem()).getName()).show();
    }
</code></pre>

<p>The EditMenu is implemented the following way:</p>

<pre><code>public class EditMenu {

    private final String DELETE_PROJECT = "Projekt löschen";
    private final String DELETE_LIST = "Liste löschen";
    private final String RENAME_PROJECT = "Projekt umbenennen";
    private final String RENAME_LIST = "Liste umbenennen";
    private final String CLOSE = "Menü schliessen";

    private Context context;
    private String projectName;
    private String listName;
    private AlertDialog alert;

    private final CharSequence[] items = {DELETE_PROJECT, DELETE_LIST, RENAME_PROJECT, RENAME_LIST, CLOSE};

    public EditMenu(Context context, String projectName, String listName) {
        this.context = context;
        this.projectName = projectName;
        this.listName = listName;
    }

    public void show() {
        AlertDialog.Builder builder = new AlertDialog.Builder(context);
        builder.setTitle(projectName + ": " + listName);
        builder.setItems(items, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int item) {
                if (items[item].equals(DELETE_PROJECT)) {
                    deleteProject();
                } else if (items[item].equals(DELETE_LIST)) {
                    deleteList();
                } else if (items[item].equals(RENAME_PROJECT)) {
                    renameProject();
                } else if (items[item].equals(RENAME_LIST)) {
                    renameList();
                } else if (items[item].equals(CLOSE)) {
                    close();
                }
            }
        });
        alert = builder.create();
        alert.show();
    }

    private void deleteProject() {

    }

    private void deleteList() {

    }

    private void renameProject() {

    }

    private void renameList() {

    }

    private void close() {

    }
}
</code></pre>

<p>This works correctly if I click the menu button the first time. But if the context menu is closed and i click the menu button a second time, nothing happens.</p>

<p>I also tried to call</p>

<p>alert.close(), alert.hide(), alert.dismiss(), etc in the method close(), but it doesn't improve the situation. any hints? thankS¨!</p>
