Answer the question
In order to leave comments, you need to log in
How to implement request cache in Robospice?
How to implement a request cache in Robospice, so that you can then continue executing a request after changing the orientation. When specifying the key and storage time in mSpiceManager.execute(...), the request is not executed, if I pass SpiceRequest and SpiceListener, then the request is executed, but when the screen is rotated and connected to the request being executed using mSpiceManager.addListenerIfPending(...) the onRequestNotFound() method fires. I looked at examples on GitHub and did not find anything about caching methods and methods. I assume that caching should be done in the service. In the service I used both InFileStringObjectPersister and LruCacheStringObjectPersister as in the example, it still does not help. And if this is important, then in the RequestListener I do not have a default java object of type String, but somewhere like this:
private final class TestRequestListener implements PendingRequestListener<PropositionsArray> {
@Override
public void onRequestFailure(SpiceException spiceException) {
Toast.makeText(getActivity(), spiceException.getMessage(), Toast.LENGTH_LONG).show();
mProgressBarData.setVisibility(View.GONE);
mRefreshLayout.setVisibility(View.VISIBLE);
}
@Override
public void onRequestSuccess(PropositionsArray response) {...}
@Override
public void onRequestNotFound() {
Toast.makeText(getActivity(), "Error", Toast.LENGTH_LONG).show();
mProgressBarData.setVisibility(View.GONE);
mRefreshLayout.setVisibility(View.VISIBLE);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question