Android Question Text Style

WofaCle

Member
I have attached my database file and image as reference.
So the issue is the database has two tables content and messages table, so with the messages table i want to bold or change the color of the text headings, the one in the pictures thats all please help me i used cursor to retrieve the data.
 

Attachments

  • CyoHanbook.zip
    16.6 KB · Views: 36
  • Capture+_2023-10-23-08-48-18_090548.jpg
    Capture+_2023-10-23-08-48-18_090548.jpg
    272.8 KB · Views: 42

Brian Dean

Well-Known Member
Licensed User
Longtime User
You have set yourself a very difficult target. Normally text which is meant to be formatted with bold or underlined sections contains "tags" within the text which define the formatting required. HTML is a formatting language that is built upon such tags.

Your text does not include any formatting information; in that case you need some other method to determine which words need to be treated differently. Looking at the text in your database the best method that I could suggest would be "If a word is written completely in uppercase then show it in bold type". However I would be surprised if this rule serves all of your requirements.

If that rule is indeed what you want then every time you put text into a text box you will have to analyse the text string word-by-word and test if each word contains only uppercase letters. Then, if you are using CSBuilder or BBCodeView you will have to build a new string, word-by-word, inserting formatting information before you display the string in a view.

This will be quite difficult to do, even if you already had some coding experience, and I suspect that you do not. You would almost certainly want to use Regex matching, for example. I have looked at the problem for nearly an hour to see if I could find a way to make the task fairly simple, but I could not.
 
Upvote 0

WofaCle

Member
You have set yourself a very difficult target. Normally text which is meant to be formatted with bold or underlined sections contains "tags" within the text which define the formatting required. HTML is a formatting language that is built upon such tags.

Your text does not include any formatting information; in that case you need some other method to determine which words need to be treated differently. Looking at the text in your database the best method that I could suggest would be "If a word is written completely in uppercase then show it in bold type". However I would be surprised if this rule serves all of your requirements.

If that rule is indeed what you want then every time you put text into a text box you will have to analyse the text string word-by-word and test if each word contains only uppercase letters. Then, if you are using CSBuilder or BBCodeView you will have to build a new string, word-by-word, inserting formatting information before you display the string in a view.

This will be quite difficult to do, even if you already had some coding experience, and I suspect that you do not. You would almost certainly want to use Regex matching, for example. I have looked at the problem for nearly an hour to see if I could find a way to make the task fairly simple, but I could not.
Yes please infact the words in the upper case is what i want to apply the text formatting on...am new in programming that's why i would be glad if i get any code snippets to do that please thank you
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
please help me
I can get you an xCustomListView project using your database featuring CSBuilder. But as was mentioned to you by @Brian Dean, there is no way to tell which words need to be bold or colored in your body of text. The titles will be however bold and colored. You will be able to see all the title and their corresponding body of text ( see screenshot).. By the way you do not need both tables. Only the messages table is needed.
1699828744575.png
 
Upvote 0

WofaCle

Member
I can get you an xCustomListView project using your database featuring CSBuilder. But as was mentioned to you by @Brian Dean, there is no way to tell which words need to be bold or colored in your body of text. The titles will be however bold and colored. You will be able to see all the title and their corresponding body of text ( see screenshot).. By the way you do not need both tables. Only the messages table is needed.
View attachment 147711
Wow okay thank you soo much @Mahare am greatful please can i get the code God bless you
 
Upvote 0
Top