Skip to content
Advertisement

List All Data Using Retrofit/OkHttp With Response List

I have some codes that fetch some data from my API. My question is how can I list all the objects that I fetched before without using this jsonData.get(0), I expect something like jsonData.get(i), so I assume using something like below, but I can’t use it, so how can I do that? Thanks.

JavaScript

MainActivity.java

JavaScript

With POJO class that looks like this

Promo.java

JavaScript

ApiUrl.java

JavaScript

Advertisement

Answer

Using for loop like below solved my problem

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