EditText and Richstring

khos

Member
Licensed User
Longtime User
Hi everyone,

I want to be able to format strings/text in an edittext control, looked at using the Richstring lib but cannot get it to work, does anyone have sample that uses richstring with edittext controls?

Or what other alternative is there to format text in a edittext?

Thanks,
Kim
 

khos

Member
Licensed User
Longtime User
Thanks for your reply Erel,

Can richstring be used with arrays e.g.:

My code sample:
Dim stringarray() As String
stringarray = Array As String("string1","string2","string3")

Code from sample/forum:
Dim rsb As RichStringBuilder
Dim rs As RichString
rs.Initialize("{C1}Me{C1}" & CRLF & "{C2}You{C2}" & CRLF)
rs.Color2(Colors.Red, "{C1}")
rs.Color2(Colors.Blue, "{C2}")
rsb.Append(rs)
EditText1.Text = rsb


How can I put the richstring into the array before I use the array in my program so the formatting is ready before I need it in say an edittext?

Is it something like stringarray (0) = rsb .... then I have do this for each array entry?

Any help is welcome
 
Upvote 0

khos

Member
Licensed User
Longtime User
Dim arrayd() As RichString
Dim rsb As RichStringBuilder

rsb.Initialize
arrayd = Array As RichString("{C1}If{C1}","text")
arrayd(0).Color2(Colors.Red, "{C1}")
rsb.Append(arrayd(0))
EditText1.Text = rsb

Gives me an:

main.java:304: inconvertible types
found : java.lang.String
required: android.text.SpannableString

error, I think I have the correct object types defined, I am still new to this so any help would be most kind.

What does "android.text.SpannableString" mean?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…