sam
sam

Reputation: 11

Options menu in an Android application

I want to open up the options menu by clicking on my own created button; is this possible?

Upvotes: 0

Views: 1883

Answers (2)

Sephy
Sephy

Reputation: 50392

If you don't want to use the button of the phone, you have to do the following :

define a listener on your button:

openMenuButton = (Button) findViewById(R.id.yourButton);
    openMenuButton .setOnClickListener(this);

and then in the method onClick(), add :

openOptionsMenu()

Upvotes: 3

Dimitar Dimitrov
Dimitar Dimitrov

Reputation: 16357

Use the openOptionsMenu() method of your Activity to open the Menu programatically.

Still, what Nikola said is right - you'd be better conforming with Android's guidelines.

Upvotes: 1

Related Questions