I have an android app. It calls a restrequest to get from a website. That website returns a JSON object. If I have a showmessage that shows the JSON object (as string) then it works fairly well. But if I comment out the Show message it never works. Sometimes I can use a ShowMessage with a static string, sometimes I need to show the response JSON. I am using ExecAsync on the request and the show message is in the success TProc. I tried some various other timing things, but nothing else worked. Any ideas at all?
Please show your actual code.
Ok, I'd rather not include my whole program, but hopefully these snippets will help:
ja : tJSONArray;
jv : tJSONValue;
ae : tJSONValue;
i : integer;
s : string;
jv := dmDoors.rsrsGetDoors.JSONValue;
ja := jv as tJSONArray;
If I remove the "ShowMessage(jv.ToString);", it fails every time, but if I keep it in, it works 95% of the time. Since it is after the Async, I assumed it cannot be timing, can it?
Fails HOW exactly? You need to be more specific. What EXACTLY is not working the way you expect? What is the result you are expecting, and what is the ACTUAL result?
The 'failure' is that the response does not return with anything. The JSONValue is blank. But if I add the Show Message back in, the Show Message shows the JSONValue and I am able to parse it correctly.
I am expecting the response to be a correct JSONValue response (an array), but with no ShowMessage it gets an empty JSONValue.
This is why I would like a chat/discord/irc so we can interact and I can explain in real time.
Thanks for your help, tho. Life just gets busy sometimes.