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
Regular Contributor
Posts: 52
Registered: ‎07-04-2011
My Device: Bold-3
My Carrier: Developer

Find text from content

Hello friends,

 

I have to find text from the HTML page.

Means I have one HTML page from which I have to find text , means the word which I type to search, if it is available in that content then it will will be highlight or get focus.

So,is it possible to do the same ?

 

Regards,

 

 

 

 

Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Find text from content

in what context? are you displaying a webpage in the browser? a browserfield? with bb java?
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Regular Contributor
Posts: 52
Registered: ‎07-04-2011
My Device: Bold-3
My Carrier: Developer

Re: Find text from content

Yes,

Displaying a webpage/HTML page in the browserfield.

Using BB java.

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

Re: Find text from content

Never done this and it is not something I think will be easy, but here is how I would go about it. 

 

You can get the HTMLElementt from the BrowserField, using getDocument(), casting to HTMLDocument, then getBody().  From there, recurse down the Nodes looking for nodes that could contain text and then searching those nodes for the text you want.

 

Once you have it, the trick is going to be how to highlight it on screen, and sorry there, I can't help. 

 

Good luck, tell us how you get on. 

Regular Contributor
Posts: 52
Registered: ‎07-04-2011
My Device: Bold-3
My Carrier: Developer

Re: Find text from content

No problem. there is need to say sorry.

You share your idea with me that will be good for me.

I will try to do your idea.

 

Thanks for reply.

 

Regards,