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 Contributor
Geetag
Posts: 4
Registered: ‎08-03-2010
My Device: Not Specified

Is it possible to call a Java fuction from html page and getting the result back in java class?

Hi All,

 

I am new to BB development.But have checked most of sample apps in BB.

 

I want  to have a " two way communication between my application and the web content".

 

I will load index.html, using BrowserField --- and in this index.html i want to call a java fucntion written in a class which extedns UIApplication, which in turn will call a javascript function mentioned in index.html. IS it possible in bb?

 

 

ex-- in my index.html

i will have an icon and on click of that i would wan to call "loadFromJavaclass" method, which i would write in my class which extends Uiapplication class.

 

And in my "loadFromJavaclass" method, i would call a javascript fucntion written in index.html .

 

Is this possible?

 

Kindly Help.

 

 

Please use plain text.
Developer
nitinverma274
Posts: 950
Registered: ‎06-22-2010
My Device: 9550

Re: Is it possible to call a Java fuction from html page and getting the result back in java class?

I think, It is Possible with servlets.

and U have to check that servlets is possible or not in BB.

 

------------------------------------------------------------------------

Press Kudoes and Accept as solution Button, If u got Answer.

Thanks.

Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.2174, Z10 (STL100-3)-10.3.0.700 Dev OS, Z30 (STA100-5)-10.3.0.700 Dev OS, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: Is it possible to call a Java fuction from html page and getting the result back in java class?

You can definitly do that with Widgets. RIM has some tutorials on how to write your own java libraries and packages them so they can be used by Widgets, thus allowing you to start a UIApplication or something similar.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
Developer
titakalpesh
Posts: 203
Registered: ‎07-30-2009
My Device: Bold(9780),Curve(8520)
My Carrier: Vodafone

Re: Is it possible to call a Java fuction from html page and getting the result back in java class?

hi ,

 

can you please any URL for tutorial to do this thing?

 

Thanks

Tita

Please use plain text.
Developer
marchywka
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: Is it possible to call a Java fuction from html page and getting the result back in java class?

Well sure with your own code you can execute arbitrary code. We are doing this, in fact

you can write an entire UI in html if you like with "custom extenstions" The latest browser

seems to ave more hooks that the older ones, but you can probably just designate

a fake host name for your arbitrary code and intercept connections to that fake destionation.

 

Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.2174, Z10 (STL100-3)-10.3.0.700 Dev OS, Z30 (STA100-5)-10.3.0.700 Dev OS, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: Is it possible to call a Java fuction from html page and getting the result back in java class?

Video:

http://www.blackberry.com/DevMediaLibrary/view.do?name=WritingJavaScriptExtensions

 

Tutorial and source:

http://na.blackberry.com/eng/developers/devbetasoftware/Lab_Widget_Extension.zip

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
Developer
marchywka
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: Is it possible to call a Java fuction from html page and getting the result back in java class?

I remember looking at those when they first came out and they did seem quite

powerful but we already had a different approach but I can't remember specifically

if there were any obvious limitations to what you could do with widgets vs a custom

browser.

 

Please use plain text.