Android Question [SOLVED]Display text from file into a label formatted as Fontawesome

AscySoft

Active Member
Licensed User
Longtime User
I have a simple text file with my app changes, and I want to load it and display it at app startup.
The output must be a label with typefece fontawesome (created with the designer).
The text from file is "bla bla...Chr(0xF0F9)... bla bla Chr(0xF0F8) "
How to correctly display it, not as a pure text with some strange simbols, but as a text with proper icons?
I manage to separate file into a list, then
B4X:
FontAwesomeLable.Text=list(0) & Chr(0xF0F9) & list(1) & Chr(0xF0F8)'etc
but it show an error (Exception) java.lang.Exception: java.lang.NumberFormatException: For input string: "0xF0F9",
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You don't need to do anything special. Just put the characters directly in the text file and save it encoded with UTF8.





B4X:
Label1.Text = File.ReadString(File.DirAssets, "example.txt")

You can use the designer icon picker to copy the icons to the clipboard and then paste them in the text editor.
 

Attachments

  • example.txt
    28 bytes · Views: 236
Upvote 0

AscySoft

Active Member
Licensed User
Longtime User
Just put the characters directly in the text file and save it encoded with UTF8.
This is the problem, becouse in my case even in unicode utf8, when I paste character selected, instead of a special character my computer insert only plain text like "Chr(0xF0F9)"
I download your file example.txt, opened it in notepad++, and paste this....is add only "Chr(0xF0F9)". I know this is silly. But I am stucked! Should I instal fontawesome in windows?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…