use of com.github.asifmujteba.easyvolley.ASFRequestListener in project EasyVolley by asifmujteba.
the class ServerController method getWomenClothingProducts.
public void getWomenClothingProducts(Object subscriber, final OnServerResponseListener<ArrayList<Product>> listener) {
EasyVolley.withGlobalQueue().load(URLWomenClothing).addParam("p1", "something").asJsonObject().setSubscriber(subscriber).setCallback(new ASFRequestListener<JsonObject>() {
@Override
public void onSuccess(JsonObject response) {
JsonArray results = response.get("metadata").getAsJsonObject().getAsJsonArray("results");
ArrayList<Product> products = Product.parseJsonArray(results);
if (listener != null) {
listener.onSuccess(products);
}
}
@Override
public void onFailure(Exception e) {
if (listener != null) {
listener.onError(e);
}
}
}).start();
}
Aggregations