use of com.itculturalfestival.smartcampus.entity.db.Banner in project SmartCampus by Vegen.
the class HomePresenter method getBanner.
@Override
public void getBanner() {
BmobQuery<Banner> query = new BmobQuery<Banner>();
// 先从缓存获取数据,如果没有,再从网络获取。
query.setCachePolicy(BmobQuery.CachePolicy.CACHE_THEN_NETWORK);
// 按照时间降序
query.order("-createdAt");
Subscription subscription = query.findObjects(new FindListener<Banner>() {
@Override
public void done(List<Banner> list, BmobException e) {
if (mView != null) {
if (e == null) {
// 请求成功
mView.showBanner(list);
mView.hideLoading(false);
} else {
mView.showMessage(HttpError.getErrorMessage(e));
mView.hideLoading(true);
}
}
}
});
mHttpLinkers.add(new SubscriptionHolder(subscription));
}
Aggregations