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

Regular Contributor
Posts: 55
Registered: ‎05-30-2011
My Device: blackberry torch 9800
My Carrier: Airtel

Run menu item : browser


I have a menu entry for MENUITEM_BROWSER and i want to trigger this menu item programmatically.

how can i do that ?


I am using the code given below to run menu item when call initiated.

private void runMenuItem(String menuItemText) {
Screen screen = Ui.getUiEngine().getActiveScreen();
Menu menu = screen.getMenu(0);
for (int i = 0, cnt = menu.getSize(); i < cnt; i++)
if(menu.getItem(i).toString().equalsIgnoreCase(men uItemText))

but it's not working in case of browser.


Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Run menu item : browser

Be aware that




will get the active screen from the running Application, not the Active screen for the Foreground application.


Not sure how to explain this, but unless you are on "good terms" with an Application - which usually means you wrote ti and can exchange global events,- you will be struiggling to have any interaction with it (other than standard APIs of course).


You can't get screens etc from other applications.  The only standard API you might consider is EventInjection, but that is dubious I think.


What are you actuially trying to do?  Perhaps we can think of a different approach?