Hi all,
I recently starting to learn Mysql using Netchicken sample of Mysql ('sql-scores')
My testproject went well except the error I get 'cannot parse .....as boolean'.
Searching at the forum I didn't find the solution what I need.
So, if you know the answer, let's hear it.
Hopefully it will,
Tia,
Asmoro
Log error:
b4a code:
Note: attached images: error on my phone and testing my db connection via browser
I recently starting to learn Mysql using Netchicken sample of Mysql ('sql-scores')
My testproject went well except the error I get 'cannot parse .....as boolean'.
Searching at the forum I didn't find the solution what I need.
So, if you know the answer, let's hear it.
Hopefully it will,
Tia,
Asmoro
Log error:
main_httpc_responsesuccess (java line: 351)
java.lang.RuntimeException: Cannot parse: Alfa RomeoItalieBMWDuitslandMercedesDuitslandAudiDuitslandPorscheDuitslandVWDuitslandSeatSpanjeAston MartinEngelandJaguarEngelandRange RoverEngelandBentleyEngelandRolls RoyceEngelandRenaultFrankrijkPeugeotFrankrijkCitroenFrankrijkFiatItalieFerrariItalieMaseratiItalieLamborghiniItalieKiaKoreaToyotaJapanNissanJapanHoldenAustralie as boolean
at anywheresoftware.b4a.BA.parseBoolean(BA.java:335)
at anywheresoftware.b4a.BA.ObjectToBoolean(BA.java:402)
at automerk.land.main._httpc_responsesuccess(main.java:351)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:113)
at anywheresoftware.b4a.BA$1.run(BA.java:218)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3701)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
at dalvik.system.NativeStart.main(Native Method)
java.lang.RuntimeException: Cannot parse: Alfa RomeoItalieBMWDuitslandMercedesDuitslandAudiDuitslandPorscheDuitslandVWDuitslandSeatSpanjeAston MartinEngelandJaguarEngelandRange RoverEngelandBentleyEngelandRolls RoyceEngelandRenaultFrankrijkPeugeotFrankrijkCitroenFrankrijkFiatItalieFerrariItalieMaseratiItalieLamborghiniItalieKiaKoreaToyotaJapanNissanJapanHoldenAustralie as boolean
b4a code:
B4X:
Sub Process_Globals
Dim httpC As HttpClient 'the Connection client
End Sub
Sub Globals
Dim pnlbg As Panel ' background panel
Dim btnsubmit As Button ' Send to DB
Dim btncallDB As Button ' Retrieve from DB
Dim txtinput As EditText ' Text entry field
Dim lvoutput As ListView ' Show the messages from the DB
Dim reader As TextReader ' reading the text from the DB
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("main")
httpC.Initialize("httpC")
'keeps it transparent wehn you scroll to see the text
lvoutput.ScrollingBackgroundColor = Colors.Transparent
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub btncallDB_Click
Dim req As HttpRequest ' requesting net data
req.InitializeGet("http://mysqlandroid.webatu.com/Automerk.php?action=getall")
httpC.Execute(req, 1)
ProgressDialogShow("Fetching all data...")
End Sub
Sub httpC_ResponseSuccess (Response As HttpResponse, TaskId As Int)
lvoutput.Clear
'download results
Dim result As String
result = Response.GetString("UTF8")
'strip out the underscores
result = result.Replace("_"," ")
'write it to a file
File.WriteString(File.DirInternalCache, "automerk.txt",result)
'get it back from the file
reader.Initialize(File.OpenInput(File.DirInternalCache, "automerk.txt"))
Dim Merk, Land As String
Merk = reader.ReadLine
Land = reader.ReadLine
Dim i As Int :i = 0
Do While Merk, Land <> Null
i = i+1
Dim linetext As String
linetext = reader.ReadLine
lvoutput.SingleLineLayout.Label.TextSize = 16
lvoutput.SingleLineLayout.ItemHeight = 35
lvoutput.SingleLineLayout.Label.TextColor = Colors.Black
lvoutput.AddSingleLine(i&" "& Merk & Land &" "& linetext)
Merk = reader.ReadLine
Land = reader.ReadLine
Loop
reader.Close
ProgressDialogHide
lvoutput.SetSelection(0)
End Sub
Sub lvoutput_ItemClick(Position As Int, Value As Object)
Msgbox(Value, "Message")
End Sub
Sub httpC_ResponseError (Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int)
Msgbox("Error connecting to server"&CRLF&CRLF&Reason,"Error ("&StatusCode&")")
ProgressDialogHide
End Sub
'SUBMIT MESSAGE
Sub btnsubmit_click
Activity.Title = "Submitted"
'Log(deviceID)
Dim inputtext As String
inputtext = txtinput.Text
If inputtext <>"" Then
inputtext = inputtext.Replace(" ", "_")
ProgressDialogShow("Submitting data...")
Dim req As HttpRequest
sendrequest = "http://mysqlandroid.webatu.com/Automerk.php?action=add&Merk&Land="
req.InitializeGet(sendrequest & "" &"&text=" & inputtext)
httpC.Execute(req, 1)
Else
ToastMessageShow("Put a message in first", False)
End If
'clear the text box
txtinput.Text = ""
End Sub
Note: attached images: error on my phone and testing my db connection via browser