It is done when you create the menu item for the context menu.

For example,

        MenuItem addItem = menu.add("Add");
        addItem.setOnMenuItemClickListener(menuItemClickListener);

The "menu" variable refers to the ContextMenu parameter that you receive
from onCreateContextMenu. Your class that is responsible to create the menus
into the context menu should probably have MenuItemClickListener as an
additional parameter as well.


On Tue, Mar 16, 2010 at 11:43 AM, ccal <[email protected]> wrote:

> Hey Makas,
> Thanks for the reply.
>
> I actually didn't use MenuItemClickListener at all.
> I use registerForContextMenu, onCreateContextMenu, and
> onContextItemSelected .
> Where should I fit setOnMenuItemClickListener(listener) in between
> these?
>
> Thanks
>
>
>
> On Mar 15, 5:32 pm, Makas Tzavellas <[email protected]> wrote:
> > Are you sure that you have set the MenuItemClickListener
> > "setOnMenuItemClickListener(listener)" on the MenuItems properly?
> >
> > Makas
> >
> > On Mar 14, 4:27 am, ccal <[email protected]> wrote:
> >
> > > Hello,
> >
> > > I am creating a context menu in separate class from the listview,
> > > because the contextmenu will be access by several listviews in
> > > different classes.
> > > Whenever I long-click the listview, contextmenu pops up, but nothing
> > > happens when the options were chosen.
> > > Tried to look at logcat message and it said something like this:
> >
> > > Window already focused, ignoring focus gain of:
> > > com.android.internal.view.iinputmethodclient$stub$pr...@43c488f8
> >
> > > Any idea what really causing this problem?
> > > cause it works perfectly fine if i put the contextmenu on the same
> > > class as listview.
> >
> > > Thanks
>
> --
> 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