I have one request type and several request parameters. For example, i need to download some internet pages and i have param = "pageNumber"
. I called:
mRequest = new SpiceRaspRequest(pageNumber);
mSpiceManager.execute(mRequest, new RequestResultListener());
But in onRequestSuccess
/onRequestFailure
i have only "result". If i call several requests, I won't know - for what request they are, because results can fire asynchronously.
Is it possible to know - which result for what request is?
Well, i find more simple and clear way. Just create individual listener for every request:
mRequest = new SpiceRaspRequest(pageNumber);
mSpiceManager.execute(mRequest, new RequestResultListener(pageNumber));
then in listeners:
private class RequestResultListener implements RequestListener<RaspRequest> {
private int pageNumber;
public RequestResultListener(int pageNumber) {
this.pageNumber = pageNumber;
}
@Override
public void onRequestFailure(SpiceException e) {
}
@Override
public void onRequestSuccess(RaspRequest raspRequest) {
}
}
Thats all! No need to override tons of code.