Hi first week using basic/B4A and I'm stuck searched around the forum and stackoverflow and can't get to the bottom of why this won't work.
I have a simple textbox and button and want to send to a php script for processing. The variable q is required for debugging purpose I've echoed the q.Text.
Can anyone point me to a fix?
I have a simple textbox and button and want to send to a php script for processing. The variable q is required for debugging purpose I've echoed the q.Text.
Can anyone point me to a fix?
B4X:
#Region Project Attributes
#ApplicationLabel: Search
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: True
#IncludeTitle: True
#End Region
'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 q As EditText
q.Initialize("q")
Dim cmdSubmit As Button
cmdSubmit.Initialize("cmdSubmit")
cmdSubmit.Text = "Search"
Private WebView1 As WebView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.AddView(q, 10, 10, 100%x-20,100)
Activity.AddView(cmdSubmit, 10, 110, 100%x-20,100)
End Sub
Sub cmdSubmit_Click
Dim jobPost As HttpJob
jobPost.Initialize("JobPostName",Me)
jobPost.PostString("http://server.com/i.php?var=1","&q="&q.Text)
End Sub
Sub JobDone (Job As HttpJob)
Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
If Job.Success = True Then
Select Job.JobName
Case "JobPostName"
ToastMessageShow(q.Text, True)
WebView1.Initialize("WebView1_Click")
Activity.LoadLayout("WebView")
WebView1.loadhtml(Job.GetString)
End Select
Else
Log("Error: " & Job.ErrorMessage)
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
Job.Release
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub