I may be wrong but I don't think that item.getItemId refers to a resource
id...  I may be wrong though because I have never create a menu via XML
(though I do almost all other layouts in XML).  I usually do the menus in
code.

What I do is create a constant int variable such as:

protected static int CONTEXT_MENU_FACEBOOK_ID = 0;
protected static int CONTEXT_MENU_YOUTUBE_ID = 1;

When I create the context menu (in code) I assign the item id's that I
defined above. And then I would have my comparisons as follows:

 if (item.getItemId() == CONTEXT_MENU_FACEBOOK_ID)
{
     //TODO open fb
    return true;
}
else if (item.getItemId() == CONTEXT_MENU_YOUTUBE_ID)
{
     //TODO open youtube
    return true;
}

----------------------------------------------------------------------
There are only 10 types of people in the world...
Those who know binary and those who don't.
----------------------------------------------------------------------


On Thu, Jul 15, 2010 at 2:16 PM, kivy <[email protected]> wrote:

>
>        public boolean onContextItemSelected (MenuItem item){

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to