RESOLVED SORT OF SEE BELOW:
Been trying to solve this problem, there are alot of examples on the forums, but non of them have seemed to work in this situation. Them seem to be all local db.
I am attempting a 'Dictionary Type' app. I want to user to be able to search with a edittext view or search bar.
I can load the 'words' my db into a ListView, and when a field is clicked get the definition to load from the db.
This works fine to click on listview of Words:
I dont see why I can't us a string variable from the user's input in a EditText view or the Android Search Bar, and putting it the query doesn't work. Trying to figure out why this does not work. (Logs show blank [] server response),:THIS DOES WORK IF USED AS BUTTON_CLICK AND NOT EDITTEXT_ENTERPRESSED
This is the ExcecuteRemoteQuery code if that matters, pretty much based off Erel's MySql example :
Been trying to solve this problem, there are alot of examples on the forums, but non of them have seemed to work in this situation. Them seem to be all local db.
I am attempting a 'Dictionary Type' app. I want to user to be able to search with a edittext view or search bar.
I can load the 'words' my db into a ListView, and when a field is clicked get the definition to load from the db.
This works fine to click on listview of Words:
B4X:
Sub ListView1_ItemClick (Position As Int, Value As Object)
Dim tl As TwoLines
tl = Value
lblWord.Text = tl.First
lblDefinition.Text = "Contacting Server..."
ExecuteRemoteQuery("SELECT definition FROM dictionary WHERE id='" & tl.Second & "'", WORD_DEFINITION)
End Sub
I dont see why I can't us a string variable from the user's input in a EditText view or the Android Search Bar, and putting it the query doesn't work. Trying to figure out why this does not work. (Logs show blank [] server response),:THIS DOES WORK IF USED AS BUTTON_CLICK AND NOT EDITTEXT_ENTERPRESSED
B4X:
Sub EditText1_EnterPressed
Dim usrInPut As String
usrInPut = EditText1.Text
lblDefinition.Text = "Contacting server..."
ExecuteRemoteQuery("SELECT definition FROM dictionary WHERE id='" & usrInPut & "'", WORD_DEFINITION)
End Sub
This is the ExcecuteRemoteQuery code if that matters, pretty much based off Erel's MySql example :
B4X:
Sub ExecuteRemoteQuery(Query As String, TaskId As Int)
Dim req As HttpRequest
req.InitializePost2("http://mysite.myserver.com/", Query.GetBytes("UTF8"))
hc.Execute(req, TaskId)
End Sub
Last edited: