How do I set the intent of menu items defined in an Android menu xml file?

Posted by Benju on Stack Overflow See other posts from Stack Overflow or by Benju
Published on 2010-03-26T04:10:07Z Indexed on 2010/03/26 4:13 UTC
Read the original article Hit count: 530

Filed under:
|

How do I set the intent of menu items defined in an Android menu xml file? For example I currently have...

<menu xmlns:android="http://schemas.android.com/apk/res/android" android:name="Main Menu">
    <item android:title="@string/resume_game" android:icon="@drawable/resume"></item>
    <item android:title="@string/play_golf" android:icon="@drawable/play_golf"></item>
    <item android:title="@string/my_rounds" android:icon="@drawable/my_rounds"></item>
</menu>

And in my Activity I have the following method overriden...

   @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);
        getMenuInflater().inflate(R.menu.main_menu, menu);
        final MenuItem menuItem = (MenuItem) menu.findItem(R.id.about_item);

        return true;
    }

© Stack Overflow or respective owner

Related posts about android

Related posts about android-widget