Rodrigo Scharnberg
Rodrigo Scharnberg

Reputation: 3

How to open the MenuInflater with a button on Screen?

Is there any way to open the MenuInflater using the onClick call?

if you use:

public void onClick(View v)
{

I'm not able to initialize the Menu.

Menu menu = new Menu()
inflater.inflate(R.menu.picture_menu, menu);

And I believe there is no way to call this

public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.picture_menu, menu);
}

if not through the MENU BUTTON;

Is that it?

Upvotes: 0

Views: 556

Answers (1)

Sam
Sam

Reputation: 86948

You can call Activity.openOptionsMenu() in your onClick()

Upvotes: 1

Related Questions