Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
Kalamity
Posts: 7
Registered: ‎01-14-2009
My Device: Not Specified

Re: Context Sensitive AddMenuItem

The MessageListDemo has menu items added to it's own messages, I'm referring mostly to the MessageListDemoDaemon.java file. Is there a way to generalize this method to be added to just the 'inbox' only?

 

 

ApplicationMenuItem openMenuItem = new OpenContextMenu( 0 ); // ... // ... static class OpenContextMenu extends ApplicationMenuItem { public OpenContextMenu( int order ) { super( order ); } public Object run( Object context ) { if( context instanceof DemoMessage ) { DemoMessage message = (DemoMessage) context; // Update status if message is new. if( message.isNew() ) { message.markRead(); ApplicationMessageFolderRegistry reg = ApplicationMessageFolderRegistry.getInstance(); ApplicationMessageFolder folder = reg.getApplicationFolder( MessageListDemo.INBOX_FOLDER_ID ); folder.fireElementUpdated( message, message ); } // Show message. DemoMessageScreen previewScreen = new DemoMessageScreen( message ); UiApplication uiApplication = UiApplication.getUiApplication(); uiApplication.pushScreen( previewScreen ); uiApplication.requestForeground(); } return context; } public String toString() { return "View Demo Message"; }

 

 

 

BlackBerry Development Advisor
MSohm
Posts: 14,752
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: Context Sensitive AddMenuItem

No, this is not currently supported.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
jacytan
Posts: 88
Registered: ‎11-04-2008
My Device: Not Specified

Re: Context Sensitive AddMenuItem

Hi,

 

I have another question regarding Multiple Selection of Messages. I used the addMenuItem() and i selected multiple messages to be processed. But when i checked the context object, it is null. Does this mean that multiple selection is not possible? is there any work around to this problem, maybe?

BlackBerry Development Advisor
MSohm
Posts: 14,752
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: Context Sensitive AddMenuItem

This is the current expected behaviour.  A selection of multiple items in the message list results in a null value passed to an ApplicationMenuItem.  Only single selected are passed to the run method.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
jacytan
Posts: 88
Registered: ‎11-04-2008
My Device: Not Specified

Re: Context Sensitive AddMenuItem

Is there any way where i can get the multiple selected messages using the ApplicationMenuItem?
BlackBerry Development Advisor
MSohm
Posts: 14,752
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: Context Sensitive AddMenuItem

No, only a single selection is supported.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
pchui
Posts: 1
Registered: ‎10-14-2009
My Device: Not Specified

Re: Context Sensitive AddMenuItem

There doesn't seem to be any way for an ApplicationMenuItem.run() to detect multiple selection through the context parameter. The object context is _not_ always null when handling multiple selection. If you open a message, then go back to the message list and select multiple items, the object context is the last opened message.

 

Do you know if it's possible to check the messages screen for the list of selected messages?