Android Question Seekbar values to string

Danbicky

Member
Licensed User
Longtime User
Hi Guys,

I have three seekbars for R G B control of my lighting system. How can I build a string and to incorporate all of these values any ideas?

The string vdata needs the following formatting:
"All;custom;RVALUE;GVALUE;BVALUE;" The semicolons are parsed by hardware, the RGB values are
anywhere from 0 - 255.

This is my code so far:

Code in Activity:

B4X:
Sub Butt_Send_Click
    Dim vdata As String
    vdata = "All;custom;" += SeekRed.Value += ";" + SeekGreen.Value += SeekBlue.Value += ";"
    UDP.UDP_Command(vdata)
End Sub


Code in a module:

B4X:
Sub UDP_Command(vCommand As String)
    Dim Packet As UDPPacket
    Dim data() As Byte = vCommand.GetBytes("UTF8")
    Packet.Initialize(data, Server_IP, Server_Port)
    UDPSocket1.Send(Packet)
End Sub
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
Try this...
B4X:
vdata = "All;custom;" & SeekRed.Value & ";" & SeekGreen.Value & ";" & SeekBlue.Value & ";"
You were nearly there :)
 
Upvote 0
Top