Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Multiple parameters in @OptionsMenu #246

Description

@naixx

Sometimes it is useful to combine menus when sharing different menu layouts between activities. E.g. :

@OptionsMenu({R.menu.menu, R.menu.additional})
class SomeActivity {...}

The generated code could be:

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater menuInflater = getSupportMenuInflater();
    menuInflater.inflate(your.package.R.menu.menu, menu);
    menuInflater.inflate(your.package.R.menu.additional, menu);
    return super.onCreateOptionsMenu(menu);
}

The order should preserve.

Activity

  1. pyricau commented on Jun 28, 2012

    @pyricau
    Contributor

    I didn't know we could do that in Android. Nice :) .

  2. pyricau commented on Jun 28, 2012

    @pyricau
    Contributor

    Updated the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions