Change color of specific text only in text box of BlackBerry


How to change color of specific text only in textbox for Blackberry applications?

Best Solution

Unfortunately the answer is roll your own - there's no editable text field control that lets you change the font color at all. @Mark Novakowski's answer is a standard way of working around that, but will change all the text to one color.

If you're not worried about supporting the Pearl-style SureType keyboard, then you can override keyChar on ActiveRichTextField and manually add characters to the text in ActiveRichTextField.

For SureType fields, the answer is even worse - you don't have low level access to the SureType APIs (for correctly dealing with the predictive text popup) for non-qwerty phones (the Pearl series) so you have to resort to some real trickery to get a fully custom text field to function correctly on those devices. It may come down to having to have multiple EditFields arranged in a manager, with e.g. one EditField overridden to show read (as in Marks' answer). The trick there will be dynamically creating and adding text fields as necessary.

Yes, sometimes the RIM API makes easy things easy, and hard things nearly impossible.

Related Question