Hello,
The carList is declared as a public variable in the class, and the log shows that values are added in the array, yet when I call the list is empty, how to solve it with Volley response?
The arratList instance is created before onResponse, the method which is using the array is added after the RequestQueueSingleton method.
Thanks,
The carList is declared as a public variable in the class, and the log shows that values are added in the array, yet when I call the list is empty, how to solve it with Volley response?
The arratList instance is created before onResponse, the method which is using the array is added after the RequestQueueSingleton method.
Java:
public void onResponse(JSONObject response) {
try {
JSONArray resArray = response.getJSONArray("result");
for(int i=0;i<resArray.length();i++) {
JSONObject car = resArray.getJSONObject(i);
String id = car.getString("id");
String brand = car.getString("brand");
String created = car.getString("created");
carList.add(new CarListItem(brand, plate_number));
Log.d(TAG, "ADDED___: " +brand + " " + plate_number);
}
Thanks,

