Hello+questions

axelands

New Member
Hello i am new :sign0089:
i love programming vb was great but c++make me :BangHead: well
3 questions
1 how i publish my .apk files?
2 it is possible to send SMS with wi-fi without use the credit
3 it is this code ok
Sub Process_Globals

End Sub

Sub Globals
Dim Number As Int
Dim name As EditText 'will hold a reference to the view added by the designer
End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout1") 'Load the layout file.
MyNumber = Rnd(1, 4) 'Choose a random number between 1 to 3
If number.Text = 1 Then
name = sophie
else
If number.Text = 2 Then
name = nina
else
If number.Text = 3 Then
name = angus
end if
End Sub

Sub Button1_Click
If EditText1.Text = name Then
ToastMessageShow("Well done.", True)
else
ToastMessageShow("No thats not.", False)
End If
EditText1.SelectAll
End Sub
tnx
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. Do you mean how to install an apk file?
There are several ways to do it. You can copy the file to the sdcard and then use a file manager to install it. If your device supports debugging then the IDE will automatically install it. Other options: http://www.b4x.com/forum/basic4andr.../6905-nice-utity-wireless-file-transfers.html
2. Not that I'm aware of.
3. Some corrections are required:
B4X:
Sub Process_Globals

End Sub

Sub Globals
    Dim name As String
    Dim EditText1 As EditText
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout1") 'Load the layout file.
    Dim number As Int
    number = Rnd(1, 4) 'Choose a random number between 1 to 3
    If number = 1 Then
        name = "sophie"
    Else If number = 2 Then
        name = "nina"
    Else If number = 3 Then
        name = "angus"
    End If
    'another way:
'    Dim names() As String
'    names = Array As String("sophie", "nina", "angus")
'    name = names(Rnd(0, 3))
End Sub

Sub Button1_Click
    If EditText1.Text.ToLowerCase = name Then
        ToastMessageShow("Well done.", True)
    Else
        ToastMessageShow("No thats not.", False)
    End If
    EditText1.SelectAll
End Sub
 
Upvote 0

axelands

New Member
my code + problem

this code is for just play
1.the cpu thinks a number 1 to 25
2.with the number select his pre determinated name
3.you need to "discover the name"
1. 'Activity module
2. Sub Process_Globals
3. End Sub
4. Sub Globals
5. Dim Numero As Int
6. Dim nombre As EditText 'will hold a reference to the view added by the Designer
7. End Sub
8. Sub Activity_Create(FirstTime As Boolean)
9. Activity.LoadLayout("Layout1") 'Load the layout file.
10. Numero = Rnd(1, 26) 'Elige un numero entre 1 y 25
11. If Numero = 1 Then
12. nombre = "Jacob"
13. Else
14. If Numero = 2 Then
15. nombre = "Emily"
16. Else
17. If Numero = 3 Then
18. nombre = "Michael"
19. Else
20. If Numero = 4 Then
21. nombre = "Joshua"
22. Else
23. If Numero = 5 Then
24. nombre = "Matthew"
25. Else
26. If Numero = 6 Then
27. nombre = "Ethan"
28. Else
29. If Numero = 7 Then
30. nombre = "Andrew"
31. Else
32. If Numero = 8 Then
33. nombre = "Emma"
34. Else
35. If Numero = 9 Then
36. nombre = "daniel"
37. Else
38. If Numero = 10 Then
39. nombre = "madison"
40. Else
41. If Numero = 11 Then
42. nombre = "Anthony"
43. Else
44. If Numero = 12 Then
45. nombre = "christopher"
46. Else
47. If Numero = 13 Then
48. nombre = "joseph"
49. Else
50. If Numero = 14 Then
51. nombre = "william"
52. Else
53. If Numero = 15 Then
54. nombre = "alexander"
55. Else
56. If Numero = 16 Then
57. nombre = "ryan"
58. Else
59. If Numero = 17 Then
60. nombre = "david"
61. Else
62. If Numero = 18 Then
63. nombre = "nicholas"
64. Else
65. If Numero = 19 Then
66. nombre = "tyler"
67. Else
68. If Numero = 20 Then
69. nombre = "james"
70. Else
71. If Numero = 21 Then
72. nombre = "abigail"
73. Else
74. If Numero = 22 Then
75. nombre = "john"
76. Else
77. If Numero = 23 Then
78. nombre = "olivia"
79. Else
80. If Numero = 24 Then
81. nombre = "isabella"
82. Else
83. If Numero = 25 Then
84. nombre = "daniel"
85. End Sub
86. Sub Boton1_Click
87. If text.Text > numero Then
88. ToastMessageShow("No es este el nombre.", False)
89. Else
90. If text.Text < numeror Then
91. ToastMessageShow("No es este el nombre.", False)
92. Else
93. ToastMessageShow("Lo lograstes ese es el nombre!.", True)
94. End If
95. EditText1.SelectAll
96. button1.enabled = False
97. button2.enabled = True
98. Sub Activity_Resume
99. End Sub
100. Sub Button3_Click
101. image1.visible = True
102. lista.nombres.visible = True
103. ok.enabled = True
104. ok.visible = True
105. End Sub
106. Sub ok_Click
107. image1.visible = False
108. lista.nombres.visible = False
109. ok.enabled = False
110. ok.visible = False
111. End Sub
112. Sub Activity_Pause (UserClosed As Boolean)
113. End Sub
problem:
the compiling sofware says this error:
Compiling code. Error
Error parsing program.
Error description: Missing Keyword: end if
Occurred on line: 85
End Sub
IF YOU NEED IT TO RE COPY HERE IS IT WITHOUT NUMBRES :)
'Activity module
Sub Process_Globals
End Sub
Sub Globals
Dim Numero As Int
Dim nombre As EditText 'will hold a reference to the view added by the Designer
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout1") 'Load the layout file.
Numero = Rnd(1, 26) 'Elige un numero entre 1 y 25
If Numero = 1 Then
nombre = "Jacob"
Else
If Numero = 2 Then
nombre = "Emily"
Else
If Numero = 3 Then
nombre = "Michael"
Else
If Numero = 4 Then
nombre = "Joshua"
Else
If Numero = 5 Then
nombre = "Matthew"
Else
If Numero = 6 Then
nombre = "Ethan"
Else
If Numero = 7 Then
nombre = "Andrew"
Else
If Numero = 8 Then
nombre = "Emma"
Else
If Numero = 9 Then
nombre = "daniel"
Else
If Numero = 10 Then
nombre = "madison"
Else
If Numero = 11 Then
nombre = "Anthony"
Else
If Numero = 12 Then
nombre = "christopher"
Else
If Numero = 13 Then
nombre = "joseph"
Else
If Numero = 14 Then
nombre = "william"
Else
If Numero = 15 Then
nombre = "alexander"
Else
If Numero = 16 Then
nombre = "ryan"
Else
If Numero = 17 Then
nombre = "david"
Else
If Numero = 18 Then
nombre = "nicholas"
Else
If Numero = 19 Then
nombre = "tyler"
Else
If Numero = 20 Then
nombre = "james"
Else
If Numero = 21 Then
nombre = "abigail"
Else
If Numero = 22 Then
nombre = "john"
Else
If Numero = 23 Then
nombre = "olivia"
Else
If Numero = 24 Then
nombre = "isabella"
Else
If Numero = 25 Then
nombre = "daniel"
End Sub
Sub Boton1_Click
If text.Text > numero Then
ToastMessageShow("No es este el nombre.", False)
Else
If text.Text < numeror Then
ToastMessageShow("No es este el nombre.", False)
Else
ToastMessageShow("Lo lograstes ese es el nombre!.", True)
End If
EditText1.SelectAll
button1.enabled = False
button2.enabled = True
Sub Activity_Resume
End Sub
Sub Button3_Click
image1.visible = True
lista.nombres.visible = True
ok.enabled = True
ok.visible = True
End Sub
Sub ok_Click
image1.visible = False
lista.nombres.visible = False
ok.enabled = False
ok.visible = False
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
:sign0085:ME
 
Last edited:
Upvote 0
Top