Java – how to call onCreateOptionsMenu from code

I want to call onCreateOptionsMenu from my code, because if I use:

menu.setGroupEnabled(0,false);

Attached:

public Menu menu;

public boolean onCreateOptionsMenu(Menu menu) {
    this.menu = menu;
    menu.add(0,"Option");
    return true;
}

It does not work if the user has never pressed a menu button How can I do this?

thank you

PS: if this is a bad practice, let me know

Solution

I believe you want invalideoptions menu()

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>