BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 03-15-2010, 06:18 AM   #1 (permalink)
New Member
 
Join Date: Mar 2010
Model: 7100t
PIN: N/A
Carrier: dnt no
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Diffrent text colour in same string

Please Login to Remove!

Hi I have a string of text which will be constantly changing since It downloads every time you start the app, but that is not the problem I just want you to know the situation.

Know the string holds a series of information in the same format such as name, date, status etc. So how do I change the colour of only one part of the string and use a different colour for other parts. I will oly need three colours.

I don't think that creating three text fields with diffrent colous will help, as the string neds to be rendered in the order it is in.

I thought perhaps finding a key value in the string such as a word which I can do between each part of the series, and then creating a new rich text field whith an asigned colour depending on a value in the string? However I do not know how to do that.

Please help, thanks.
Offline  
Old 03-15-2010, 10:09 AM   #2 (permalink)
Knows Where the Search Button Is
 
Join Date: Mar 2010
Model: N/A
PIN: N/A
Carrier: Fledge
Posts: 43
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think you are looking for advice on basic string parsing functions. Look at the String functions "substring" and "indexOf" at API Reference: String Class which can be used to find the position of text in a string and create a new string based on the starting and ending position parameters.
Offline  




Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.