BlackBerry Forums Support Community

Closed Thread
LinkBack Thread Tools
Old 02-15-2007, 12:48 PM   #1 (permalink)
New Member
Join Date: Feb 2007
Model: 7100T
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts

Please Login to Remove!


I'm trying to add a menuItem to the contact's contextMenu for every contact with email address, and for those who does not have an email address i want to grey the menu or remove it.

all i managed to do is add a menuItem to all contacts.
I tried to add an ApplicationMenuItem with specific Contact context from the PIM:

Contact c = (Contact)contacts.elementAt(i);
amir.addMenuItem(ApplicationMenuItemRepository.MENUITEM_ADDRESSCARD_VIEW, new SampleMenuItem(c));
contacts is a vector of PIM Contacts
amir is ApplicationMenuItemRepository
SampleMenuItem is a class that extends ApplicationMenuItem

Is this code is right? what am i missing here?

I see no difference between ApplicationMenuItem contructor with Contact context and the constructor without Contact context.

public ApplicationMenuItem(Object context, int order)
public ApplicationMenuItem(int order)

Old 02-18-2007, 01:15 PM   #2 (permalink)
Thumbs Must Hurt
Join Date: Oct 2006
Model: 8707g
Carrier: Hutch
Posts: 73
Post Thanks: 0
Thanked 0 Times in 0 Posts

Current API's don't allow you to selectively show ApplicationMenuItems depending on conditions. It will always be visible for all types of contacts in your case. However you can try getting the selected contact and change the text of the menu.
The text to be shown in menu can be changed by returning a different value from toString() method.

Copyright 2004-2016
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.