Android Question BBCodeView or EditText ?

js486dog

Active Member
Licensed User
Longtime User
I need to open and read txt files.
I can use EditText or BBCodeView.

I think there is some disadvantage for BBCodeView:

TXT files has to be as has to be for BBCodeView.
EditText is more freely for content of files.

Look:
from1.txt - bad file for BBCodeView.
from2.txt - good file for BBCodeView.

Look also attached project.
 

Attachments

  • from1.txt
    93 bytes · Views: 192
  • from2.txt
    82 bytes · Views: 204
  • JustifyEx_BBCV.zip
    9.7 KB · Views: 194

emexes

Expert
Licensed User
You can wrap the text with the plain tag and it will not be parsed.
Eg, read file from1.txt into a string, and then add the tags like:
B4X:
Dim PlainString As String = "[PLAIN]" & WholeFileString & "[/PLAIN]"
so that PlainString would then be:

[PLAIN]EditText works fine with this text and text […] as this.
But BBCodeView has problem.[/PLAIN]
 
Upvote 0

js486dog

Active Member
Licensed User
Longtime User
Eg, read file from1.txt into a string, and then add the tags like:
B4X:
Dim PlainString As String = "[PLAIN]" & WholeFileString & "[/PLAIN]"
so that PlainString would then be:

[PLAIN]EditText works fine with this text and text […] as this.
But BBCodeView has problem.[/PLAIN]
Thank you very much "emexes".
That's right. This code read txt files as plain files - not as code files.
I think I have to correct my first post about the disadvantage for BBCodeView.
 
Upvote 0
Top