Wednesday, April 18, 2012

HOW TO: Add a Menu for an Android App using Java in Eclipse

These are the steps needed in order to add a menu.

    1. File > New > class: BaseActivity
    2. Modify to read "BaseActivity extends Activity"
    3. CTL-SHFT-O    Organize Imports
    4. [HoverOver]    Click:    Add unimplemented methods
    5. Put common functionality such as menu items here
    7. As you add menu items, add functionality as part of a CASE: statement
    8. File > New > Android XML file > menu.xml
    9. Make sure you set the icon property in the menu.xml
  10. Update Android.manifest
  11. Update new child activity pages like this: NameOfActivity extends BaseActivity

No comments:

Post a Comment