Search code examples
androidoptionmenu

How to use Option Menu without menu button?


in my application I have option menu it run with menu button on phone my question is, if my phone has no button how it is work ?


Solution

  • OK. Here is the deal*(Considering you know how to create options menu)*. Sometimes this might become a problem to notify the user that there is some options hidden in the method. So simply you can use any buttons or images or any widgets you have used in your app to open up your options menu. Here is a sample of how it works,

        button.setOnClickListener(new OnClickListener() {
    
            public void onClick(View v) {
                openOptionsMenu();
            }
        });
    

    Calling the method, openOptionsMenu() I believe will solve your problem.