BlackBerry Forums Support Community

BlackBerry Forums Support Community (http://www.blackberryforums.com/index.php)
-   Developer Forum (http://www.blackberryforums.com/forumdisplay.php?f=15)
-   -   Run menu item : browser (http://www.blackberryforums.com/showthread.php?t=260482)

janaknayangaljanak 07-12-2012 08:14 AM

Run menu item : browser
 
Hello,

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


how can i do that ?

thanx

Dougsg38p 07-12-2012 10:56 AM

Re: Run menu item : browser
 
Where would you be triggering this from?

You can't programmatically invoke a menu item on another application from your application using the API's.

You might possibly be able to use key event injection (simulating keys pressed), but you would then have to identify when the browser is in focus and it is appropriate for you to press ths menu item.

My guess is that you are taking the long way around the block. What exactly is your use-case?

janaknayangaljanak 07-13-2012 02:07 AM

Re: Run menu item : browser
 
I am using the code given bellow 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))
menu.getItem(i).run();
}

but it's not working in case of browser.


All times are GMT -5. The time now is 04:55 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.