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
Developer
Posts: 55
Registered: ‎05-30-2011
My Device: BlackBerry torch 9800
My Carrier: Airtel

Re: how to get url from browser?

Hi peter... I have solved the issue but not completely.

 

I have add a "custom menu item" into the native browser-application with name "GetURL". By clicking on that custom-menu-item, I am receiving the URL successfully in the run() method of that custom-menu-item.

 

But this doesn't meet my requirement actually...  Smiley Sad

As I told earlier, I want to track the browser application pro-grammatically through a third party application. So Is there any way, whenever Browser app comes to foreground, we can get the menu-item instance of the Browser (native application). So that I can run the custom menu item pro-grammatically.

 

I have used the following code:

Screen screen = Ui.getUiEngine().getActiveScreen();
System.out.println("\n\n**** " + screen.getClass().getName());
Menu menu = screen.getMenu(1);

for (int i = 0, cnt = menu.getSize(); i < cnt; i++)
           System.out.println(" menu item : " + menu.getItem(i).toString());

System.out.println("\n\n");

 

I am successfully tracking the applications whichever comes to foreground through a background thread of my application, but even then My third party application's thread can't get the menu-instance of the foreground-native applications. It always return the instance of my application's screen...

 

output of the above code :

** mypackage.AppDemoScreen

menu item : Show Keyboard

menu item : Switch Application

menu item : Full Menu

 

If I want to get the url of browser, then I hv to run that custom-menu-item "GetURL" from my app's thread,  when ever user opens the  browser.  Please suggest any way....???

 

 

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

Re: how to get URL from browser?

[ Edited ]

"So Is there any way, whenever Browser app comes to foreground, we can get the menu-item instance of the Browser (native application)."

 

Short answer: There is no supported API for this, or anything like it.  .

 

Longer answer:  Aside from Event Injection, there is no way you can have any interaction with any other Application unless you establish some sort of friendly relationship with that Application, such as running an ApplicationMenu item.

Highlighted
Developer
Posts: 55
Registered: ‎05-30-2011
My Device: BlackBerry torch 9800
My Carrier: Airtel

Re: how to get URL from browser?

thanks peter for ur suggestion.


peter_strange wrote:

"So Is there any way, whenever Browser app comes to foreground, we can get the menu-item instance of the Browser (native application)."

 

Short answer: There is no supported API for this, or anything like it.  .

 

Longer answer:  Aside from Event Injection, there is no way you can have any interaction with any other Application unless you establish some sort of friendly relationship with that Application, such as running an ApplicationMenu item.