Android Question Retrieve data from MYSQL using HttpUtils2

lachica426

New Member
Hey guys. I'd like to ask how to retrieve data from MYSQL using httputils2. I've been working for this app using HttpClient and usually test it using the emulator and it's working fine. The problem is when I run it on my actual device with a higher SDK (Jelly Bean), it throws an error that says: "Network on main thread exception" and the 2nd line of this part of my code gets highlighted:
B4X:
Case getSched
       
       
        Dim res As String
        res = Response.GetString("UTF8")
        Dim parser As JSONParser
        parser.Initialize(res)
        Dim sched As List
        sched.Initialize
        sched = parser.NextArray
I've tried reading on this forum and learned that I must instead us HttpUtils2 / Response.GetAsynchronously method but the problem is, I don't know how to start and how to convert my code.. If you could give me a sample code or anything that would be very much appreciated. I badly need your help and suggestions. Thank you!
 

Dogbonesix

Active Member
Licensed User
Longtime User
It seems, I could be wrong, that the sample in the third link is the origonal http sample - not the HttpUtils2.
 
Upvote 0

Dogbonesix

Active Member
Licensed User
Longtime User
I understand one of the benefits of HttpUtils2 is the ability to use spaces and other characters that cause problems using Http... So, how might one use Use HttpUtils2 to connectconnect to MySql. Is the connection string the same? There is a Job that is associated with HttpUtils2 how is applied? Does one just replace Dim hc as HttpClient with Dim hc as HttpJob and everything remain the same?
 
Upvote 0
Top