robospice usecase: external rest-service returns null

59 Views Asked by At

I have found following code in this sample of 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());
    }
}

and then:

@Override
public void onRequestSuccess(FollowerList listFollowers) {

    // listFollowers could be null just if contentManager.getFromCache(...)
    // doesn't return anything.
    if (listFollowers == null) {
        return;
    }

    followersAdapter.clear();

So, what do you suggest to do if external rest-service will return null as successfull result oneday?

0

There are 0 best solutions below