jagguy
asked on
menu example
I am having trouble finding menu examples that work.
I copied the code and download menu examples without success.
I am after complete menu examples to learn about menus.
I copied the code and download menu examples without success.
I am after complete menu examples to learn about menus.
http://developer.android.com/guide/topics/ui/menus.html
To specify the options menu for an activity, override onCreateOptionsMenu() (fragments provide their own onCreateOptionsMenu() callback). In this method, you can inflate your menu resource (defined in XML) into the Menu provided in the callback. For example:
(here exactly the same code as yours quoted above)
If you've developed your application for Android 2.3.x and lower, the system calls onCreateOptionsMenu() to create the options menu when the user opens the menu for the first time. If you've developed for Android 3.0 and higher, the system calls onCreateOptionsMenu() when starting the activity, in order to show items to the action bar.
To specify the options menu for an activity, override onCreateOptionsMenu() (fragments provide their own onCreateOptionsMenu() callback). In this method, you can inflate your menu resource (defined in XML) into the Menu provided in the callback. For example:
(here exactly the same code as yours quoted above)
If you've developed your application for Android 2.3.x and lower, the system calls onCreateOptionsMenu() to create the options menu when the user opens the menu for the first time. If you've developed for Android 3.0 and higher, the system calls onCreateOptionsMenu() when starting the activity, in order to show items to the action bar.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the information.
Yes, AdapterView.OnItemCLickLis tener - it locates and imports both these types for me based on that code which you pointed to
ASKER
when does this code run because there is no call to this. Is it when you hit menu on the emulator?
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.me
return true;
}