Android Tutorial CharSequence / CSBuilder Tutorial

Status
Not open for further replies.

demasi

Active Member
Licensed User
Longtime User
Is there a method to measure multiine text, like string utils, but for formatted texts?
 

Cebuvi

Active Member
Licensed User
Longtime User
RelativeSize method will be OK

Thanks Erel.
 
Last edited:

demasi

Active Member
Licensed User
Longtime User
Maybe it's a good idea add to csbuilder a method to iniatilize from token marked texts, just like agraham's richtext ibrary:
B4X:
cs.initialize2("This is a {Red}RED{Red} word and this is {B}Bold{B}")
or something like this, from plain text to CS.
I have lots of "token encoded" full texts and applications that will be hard to convert to csbuilder.
 

netsistemas

Active Member
Licensed User
Longtime User
Erel, eres un máquina!!.
Erel, you are a machine!!
Perfect.
 

demasi

Active Member
Licensed User
Longtime User
Thank you, Erel.
I know, I will. But your new method is easier and better.
Sure we need a method to load a long text, already formatted and saved as txt.
I use a B4J program to encode my students lessons texts, and load already formatted to my app in assets folder. it's fast and easy.
And I still can load formatted texts from a server via webservice.
I'm trying to create a function to convert my "token encoded" texts to the new format.
But it's a lot of string manipulation. Ad I still don't know how to load from pre-formatted texts.
Please consider the idea. I'm sure it will help many others.
 

sunish

Member
Licensed User
Longtime User
Is there any memory over head in calling multiple cs.initialize as in cs.Initialize.Append for each append ?
 

luke2012

Well-Known Member
Licensed User
Longtime User
Hi Erel. First of all my compliments
Which is the code to append a "smile" icon to a cs that contains some text ?
 

asales

Expert
Licensed User
Longtime User
Hi Erel. First of all my compliments
Which is the code to append a "smile" icon to a cs that contains some text ?
B4X:
Chr(0xF118)
open the icon picker (last item in the context menu) and filter field = "smile"
 

DonManfred

Expert
Licensed User
Longtime User
Which is the code to append a "smile" icon to a cs that contains some text ?
B4X:
    Dim obj As CSBuilder
    obj.Initialize.Color(Colors.Red).Append("Hello ").Pop.Append("World!").PopAll
    Religion.Text = cs.Initialize.Append(obj).Append("FontAwesome: ").Typeface(Typeface.FONTAWESOME).Color(Colors.Blue).Append(Chr(0xF209)).PopAll

cs is a global CSBuilder...
 

luke2012

Well-Known Member
Licensed User
Longtime User
@asales & @DonManfred thanks for your help ;-)
I tryed it and it's works!

Only a doubt. How to get the code of the selected icon from the Designer picker ?
 

LucaMs

Expert
Licensed User
Longtime User

Can you use that code for an EditText and delete the images as they were simple single characters?
 

LucaMs

Expert
Licensed User
Longtime User
Hi Luca. I dont understand what you mean. Can you do a little example ?
I mean like many chats, like Whatsapp: you can write normal character, insert an emoticon but also delete it, like any other character; also, it seems to me that Erel used images as if they were emoticons, so...!

Capperi, riesco a spiegarmi meglio in italiano, penso .

Volevo sapere se usando questo nuovo "strumento" fosse possibile inserire immagini in una EditText come fossero emoticon e quindi eventualmente cancellarle con il tasto back come qualsiasi altro carattere.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Can you use that code for an EditText and delete the images as they were simple single characters?
It will probably be simpler to find a font that includes all the emojis that you like and use it.

You can assign a CharSequence to EditText. I'm not sure how it will work with the images.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…