lachica426 New Member Aug 11, 2013 #1 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: Code: Copy 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!
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: Code: Copy 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!
Erel B4X founder Staff member Licensed User Longtime User Aug 11, 2013 #2 You should follow the tutorial (third link in the Similar Threads section). It is based on HttpUtils2. Upvote 0
You should follow the tutorial (third link in the Similar Threads section). It is based on HttpUtils2.
Dogbonesix Active Member Licensed User Longtime User Aug 12, 2013 #3 It seems, I could be wrong, that the sample in the third link is the origonal http sample - not the HttpUtils2. Upvote 0
It seems, I could be wrong, that the sample in the third link is the origonal http sample - not the HttpUtils2.
Erel B4X founder Staff member Licensed User Longtime User Aug 13, 2013 #4 It is based on HttpUtils2 (the modules instead of the library, however there is no difference). Upvote 0
Dogbonesix Active Member Licensed User Longtime User Aug 13, 2013 #5 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
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?
Erel B4X founder Staff member Licensed User Longtime User Aug 14, 2013 #6 Where do you see a reference to HttpClient? There should only be one inside HttpUtils2Service. You should not modify this code. Upvote 0
Where do you see a reference to HttpClient? There should only be one inside HttpUtils2Service. You should not modify this code.
Dogbonesix Active Member Licensed User Longtime User Aug 15, 2013 #7 OK, getting closer...Still not too easy. Upvote 0