Need Help with Strings

thestar19

Member
Licensed User
Longtime User
Hey guys

Okay,so I am developing a application that should take data from some so called "editfields" and then send then all in a text message.

This is my code sofar:
B4X:
Sub Globals
Dim phone_n As EditText
Dim team1 As EditText
Dim team2 As EditText
Dim time_game As EditText
End sub

Sub send1_Click
Dim message As String
message = name.Text+","+phone_n.Text+","+team1.Text+","+team2.Text+","+time_game.Text+","
Msgbox(message,"Information")
Dim send As PhoneSms
send.Send("0707575130",message)
Activity.LoadLayout("main")
End sub

What am I doing wrong??
Please help me

Thestar19
 

Kevin

Well-Known Member
Licensed User
Longtime User
I don't have any experience with sending SMS messages, but I believe those + signs should be &.

B4X:
message = name.Text & "," & phone_n.Text & "," & team1.Text & "," & team2.Text & "," &  time_game.Text & ","

Also, has "name" been declared?

B4X:
Dim name As EditText

I see that you are also loading a layout after sending the SMS. Is there another layout that you are loading when the app starts? Otherwise there will be nothing visible to the user.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
I loaded your code into a project and made all the necessary changes, some of them I concur with Kevin. Besides this code, you need to create a layout and name it 'main'. It should have all the 6 views that I have dimmed here in the GLOBAL variables. Then to run it and send the message, simply click the Send1 button. I tested it with my phone and it worked.

B4X:
'Activity module
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.

End Sub

Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.

Dim phone_n As EditText
Dim team1 As EditText
Dim team2 As EditText
Dim time_game As EditText
Dim send1 As Button
Dim name As EditText

End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("main")

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub send1_Click
Dim message As String
message = name.Text & "," & phone_n.Text & "," & team1.Text & "," & team2.Text & "," & time_game.Text & ","
Msgbox(message,"Information")
Dim send As PhoneSms
send.send("0707575130",message)
'send.send("XXXXXXXXX",message)
'Activity.LoadLayout("main")
End Sub
 
Upvote 0

thestar19

Member
Licensed User
Longtime User
Hey guys

I had a layout called "Main" so that wasn't the problem,However,the "&" solved the problem so thank you guys.

Oh,and btw,Impressively fast response :D

Thank you
Thestar19
 
Upvote 0
Top