我在this的Spring Android module示例中找到了以下代码:
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
if (savedInstanceState.containsKey(KEY_LAST_REQUEST_CACHE_KEY)) {
lastRequestCacheKey = savedInstanceState
.getString(KEY_LAST_REQUEST_CACHE_KEY);
spiceManager.addListenerIfPending(FollowerList.class,
lastRequestCacheKey, new ListFollowersRequestListener());
spiceManager.getFromCache(FollowerList.class,
lastRequestCacheKey, DurationInMillis.ONE_MINUTE,
new ListFollowersRequestListener());
}
}
然后:
@Override
public void onRequestSuccess(FollowerList listFollowers) {
// listFollowers could be null just if contentManager.getFromCache(...)
// doesn't return anything.
if (listFollowers == null) {
return;
}
followersAdapter.clear();
那么,如果外部休息服务作为成功结果返回null
,您建议做什么?