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: 490
Registered: ‎07-16-2008
My Device: Not Specified
Accepted Solution

ActiveRichTextField - How to insert label in it ?

Hello again'

Have a good day' 

 

So, I am using ActiveRichTextField object for my application. I think argument of the construction method is required initial value. For instanse :

 

ActiveRichTextField field = new ActiveRichTextField("http://www.google.com"); // create object

add(field);                                                                                             // Add field

 

For my application, initial value is too long. So, I need to become this long URL to label.

That is to say, label of "http://www.google.com" is "Google". When I click "Goolge", go to "http://www.google.com" in the browser.

 

How to solve it ?  Plz help me guys'

 

Developer
Posts: 507
Registered: ‎07-15-2008
My Device: Not Specified

Re: ActiveRichTextField - How to insert label in it ?

Override LabelField class. This class reacts on Trackwheel click.

You may set an arbitrary label, say "Google Inc."  and an arbitrary http link, say: "http://www.microsoft.com"

 

 

public class MyLinkField extends LabelField { ...... private final String httpLink; public MyLinkField(String label, String httpLink){ super(); setText(label); this.httpLink = httpLink; } protected boolean trackwheelClick(int status, int time) { // if http link is set if (httpLink.length>0) { // opening link in browser BrowserSession browserSession = Browser.getDefaultSession(); browserSession.displayPage(httpLink); } } }

 

----------------
if your issue solved set "Solution" mark at the relevant post
Developer
Posts: 490
Registered: ‎07-16-2008
My Device: Not Specified

Re: ActiveRichTextField - How to insert label in it ?

Tnx for ur response Rafo. It is solution to solve my problem. But BrowserSession is "Signed Class".

Is there any way to solve this problem by NOT using SIGNED classes ?

 

Tnx man

Developer
Posts: 507
Registered: ‎07-15-2008
My Device: Not Specified

Re: ActiveRichTextField - How to insert label in it ?

I am not sure that's possible to solve this task without use of classes which require signing.

 

It may be a serious obstacle if you're working on an open source project.

 

In other cases - you may purchase signature keys from RIM (just $20 for unlimited use).

----------------
if your issue solved set "Solution" mark at the relevant post
Developer
Posts: 490
Registered: ‎07-16-2008
My Device: Not Specified

Re: ActiveRichTextField - How to insert label in it ?

Hello guys'

 

I researched ActiveRichTextField class. It has a method that named executeBackgroundScan(). I think this method works in background when push on active text displayed on the screen. If it is right, maybe we can work it background of LabelField. I tried to work it, but couldn't do. Because this method is defined by "protected" syntax.

 

Now I don't know how to solve this problem. Do you have any idea to solve ? 

 

I haven't good experience for Java programming. And sorry for my bad English.

 

Tnx in advice'

BlackBerry Development Advisor
Posts: 15,263
Registered: ‎07-09-2008
My Device: BlackBerry Passport
My Carrier: Bell

Re: ActiveRichTextField - How to insert label in it ?

Launching the browser from a third party application does require the user of signed APIs.  There isn't a way around that requirement.  You'll need to purchase a set of signature keys using the form here:

 

http://na.blackberry.com/eng/developers/downloads/api.jsp

 

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
Developer
Posts: 490
Registered: ‎07-16-2008
My Device: Not Specified

Re: ActiveRichTextField - How to insert label in it ?

Ok, Tnx Rafo, tnx Mark Sohm. I got ur ideas'

Tnx again'