0

I have a problem with creating a menu in Dialog. In my first activity I have ListView and when onItemLongClick called for one of menu's menu and try to show dialog the dialog not contain menu.

public class ShowMenuDialog extends Dialog {
    public enum Mode  {
        ProjectMenu,
    }

    private int ProjectID;
    private Mode mode_;

    public ShowMenuDialog(Context context, Mode mode, int ProjectID) {
        super(context);
        this.ProjectID_ = ProjectID;
        this.mode_ = mode;
    }

    public ShowMenuDialog(Context context) {
        super(context);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.showmenudialog);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);
        MenuInflater inflater = new MenuInflater(this.getContext());
        inflater.inflate(R.menu.listviewmenu, menu);
        return true;
    }
}

showmenudialog.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="265dp"
    android:orientation="vertical"
    android:layout_height="300dp">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="#000"
        android:id="@+id/ddd" />

</LinearLayout>

after loaded Dialog menu not shoed!!!

0 Answers0