Skip to content
Advertisement

Trying to explain a a java for loop which requests JSON objects and requests for Queues

I’m trying to do a written report on some code and I found one on Youtube. However, I don’t understand how some of this loop works. I understand that it goes through every item in the list and fetches each value for each variable and that it then adds all values to a list which is presented in an XML view in Android studio. if someone could breakdown what is happening it would be greatly appreciated!

JavaScript

Advertisement

Answer

Though you can simply read about the JSONObject class and all other classes belonging to the package. But, let me put it what I understand with an example here. Here is the response json that is being received.

JavaScript

The code is trying to process this complete json. It starts with reading the “data” object into an array since it represents an array and then convert every object block in that array to a Supplier model class and then add it into SupplierList.

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement