robospice usecase:external rest-service返回null

时间:2016-06-06 03:10:57

标签: java android spring robospice

我在thisSpring 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,您建议做什么?

0 个答案:

没有答案