You have to implement *onCreateOptionsMenu() *in your Activity.

public boolean *onCreateOptionsMenu*(Menu menu) {
     CreateMenu(menu);
    return(super.onCreateOptionsMenu(menu));
}

private void CreateMenu(Menu menu) {
menu.add(Menu.NONE, 1, Menu.NONE, "Add");
menu.add(Menu.NONE, 2, Menu.NONE, "Delete");
}

First try it and let me know the problem.

- Anurag Singh

On Thu, Apr 22, 2010 at 1:40 PM, 智超 薛 <[email protected]> wrote:

> hey all!
>
> meet a question about menu.
>
> i want to push a button to pop-up menu,
>
> my coding is
>
> case R.id.menus:
> if(myMenu==null) {
>                                        myMenu.add(0, 0, 0,
> "Add").setIcon(R.drawable.addfolderr);
>                                        myMenu.add(0, 1, 0,
> "Delete").setIcon(R.drawable.delete);
>                                                                        }
>                                onCreateOptionsMenu(myMenu);
> braek;
>
> but onCreateOptionsMenu(myMenu) is not work ,
> how to make it work ,or had other way to realize button pop-up menu ?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to