Just use onOptionsItemSelected if you just want to react on the panel menu
item clicks.

onMenuItemSelected seems to always be called with the featureID
FEATURE_OPTIONS_PANEL, the context menu is handled in another way. So
overriding onOptionsItemSelected is simplier.
onOptionsItemSelected must have been created for convenience purpose (or for
the adapter design pattern purpose).

2008/12/1 monkeypipi <[EMAIL PROTECTED]>

>
> Thanks Guillaume.
>
> onMenuItemSelected() is also implemented in Activity class, right?
>
> In the notepad tutorials, both methods appeared. Exercise 1 uses the
> onOptionsItemSelected, while Exe 2 uses onMenuItemSelected. I am not
> quite understand how to get the featurID and pass it to
> onMenuItemSelected().
>
> On Nov 29, 9:29 pm, Guillaume Perrot <[EMAIL PROTECTED]> wrote:
> > onMenuItemSelected comes from the Window.Callback class.
> > onOptionsItemSelected is introduced by the Activity class (which
> > implements Window.Callback) and is called by the implementation of
> > onMenuItemSelected.
> > So the difference is the abstracting level.
> >
> > Copied from doc:
> > "Default implementation of onMenuItemSelected(int, MenuItem)  for
> > activities. This calls through to the new onOptionsItemSelected
> > (MenuItem) method for the FEATURE_OPTIONS_PANEL  panel, so that
> > subclasses of Activity don't need to deal with feature codes. "
> >
> > On Nov 29, 10:23 am, monkeypipi <[EMAIL PROTECTED]> wrote:
> >
> > > Any difference? Thank you for your reply ^_^
> >
> >
> >
>

--~--~---------~--~----~------------~-------~--~----~
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