Android Question AST NEW TEXT

Arturs

Member
Licensed User
Longtime User
Hi

I have the following code:

B4X:
Sub ast_NewText(Text As String)
      
    Log(Text)
   lab_test.Text = Text

End Sub

External device send me the following string : "TEST B4A" and in Log windows I see the received String
but in lab_test (label) it is not diplayed.

Where is a problem ?

Regards
Artur
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Arturs

Member
Licensed User
Longtime User
All actions related to lab_test is only above code and
B4X:
Sub Globals

    Private lab_test As Label

End Sub

I have created Label in Designer and that's all.
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
All actions related to lab_test is only above code and
B4X:
Sub Globals

    Private lab_test As Label

End Sub

I have created Label in Designer and that's all.
Is the background on your app White, if so try changing the background to any other color, or the textcolor to something else, i've seen something like this before, where i was not seeing the text on the label because my background was white and so was the text color on the label as well.

Cheers,
Walter
 
Upvote 0

Arturs

Member
Licensed User
Longtime User
The background color is ok because if I set text in this way: lab_test.Text = "B4A TEST" then everything is ok. I only cannot see text which was received via BT bu in Log windows I see the message.

EDIT:

I found Why The message is not displayed

From another device I send string "B4A TEST" & CRLF and the aplication goes into ast_NewText two times. First it receives my string, second Time it receives "empty" string.

Why does ast_NewText even is called two times ?
 
Last edited:
Upvote 0

walterf25

Expert
Licensed User
Longtime User
The background color is ok because if I set text in this way: lab_test.Text = "B4A TEST" then everything is ok. I only cannot see text which was received via BT bu in Log windows I see the message.
Well then that's bizarre, are you sure the log you are seeing is the one from the ast_NewText(Text as String) Sub?
 
Upvote 0

Arturs

Member
Licensed User
Longtime User
I found Why The message is not displayed

From another device I send string "B4A TEST" & CRLF and the aplication goes into ast_NewText two times. First it receives my string, second Time it receives "empty" string.

If I send "B4A TEST" & CR" or "B4A TEST" & LF then everything is ok

Why does ast_NewText even is called two times when I send CR and LF together?
 
Upvote 0

Arturs

Member
Licensed User
Longtime User
Erel you are right. I made a mistake I sent /n/r instead of /r/n. Now Everything is ok.

I have another easy question.

For example I have the below strings:

S1="test1:123,test2:456"
S2= "test3:4556"

How to get only value behind ":" for S1 and for S2.

It should be for S1
123 and 456
for S2
4556

Thank you for help

Regards
Artur
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
For example I have the below strings
For the future:

- ALWAYS create a new thread for a new question.


Use RegEx to split the result into parts at the comata.Split the parts you get on : and then you have the single value(s).
Search forum about RegEx examples.
 
Upvote 0
Top